What is the dimension of the given vector space? 
Let $V$ be the real vector space of all continuous functions $f:[0, 2] \to \mathbb{R}$ such that the restriction of $f$ to the interval $[0, 1]$ is a polynomial of degree less than or equal to $2$, the restriction of $f$ to the interval $[1, 2]$ is a polynomial of degree less than or equal to $3$ and $f(0) = 0$.  Then the dimension of $V$ is equal to $\underline{\qquad}$.

(Original at https://i.stack.imgur.com/ep0s1.jpg)
So I gave an entrance exam and this was one of the questions. I answered that its dimension is 2, as the constant term in each function is 0 and there won't be $x^3$ in V as when restricted to [0,1], it won't be a polynomial of degree $\leq$2. So I am just left with $x$ and $x^2$, hence dimension of V is 2.
Is my reasoning and answer correct?

Your answer is not correct because the polynomials on $[0,1]$ and $[1,2]$ are not supposed to be the same.
The dimension of the space of the functions, without the conditions of continuity and $f(0)=0$ is equal to $3+4=7$. The conditions $f(0)=0$ and the continuity over $[0,2]$ impose two linearly independent conditions. Finally the dimension is equal to $5$.
