TITLE: Vector bundle for prescribed Stiefel-Whitney classes
QUESTION [12 upvotes]: I hope this is not trivial.
Let $B$ be a nice topological space (paracompact, CW-complex or whatever you think is nice)
For $i=1,\ldots,n$ let $x_i \in H^i(B,\mathbb{Z}_2)$ be certain cohomology classes.

Does there exists a vectorbundle $E$ of rank $n$ with $w_i=x_i$?

Of course $w_i$ is the $i$-th Stiefel Whitney class of $E$.

REPLY [13 votes]: In addition to Wu's formula mentioned in Oscar's answer, there are further obstructions coming from the fact that the mod 2 reduction of $p_i$ (the $i$th Pontryagin class) is $w_{2i}^2$. So your classes $x_{2i}$ would have to satisfy $\beta(x_{2i}^2)=0$, where $$\beta: H^{\ast}(B;\mathbb{Z}/2)\to H^{\ast+1}(B;\mathbb{Z})$$ is the Bockstein associated to the coefficient sequence $0\to \mathbb{Z}\to \mathbb{Z}\to \mathbb{Z}/2\to 0$.
(Incidentally the class $\beta(x_{2i}^2)$ is also an obstruction to $x_{2i}$ being realized by an immersion, see here.)