I'm asked to give an example where $f$ is surjective, but $g\circ f$ is not. I suspect that $f(x)=x$ and $g(x)=\frac{1}{x}$ will do the trick, namely for $f,g : \mathbb{R}\rightarrow \mathbb{R}$, right?
Well, what about where $g$ is surjective...
I'm asked to give an example where $f$ is surjective, but $g\circ f$ is not. I suspect that $f(x)=x$ and $g(x)=\frac{1}{x}$ will do the trick, namely for $f,g : \mathbb{R}\rightarrow \mathbb{R}$, right?
Well, what about where $g$ is surjective...
Since $\operatorname{f}$ is surjective, the surjectivity of $\operatorname{g} \circ \operatorname{f}$ depends on $\operatorname{g}$ alone. In fact the image of $\operatorname{g} \circ \operatorname{f}$ is just the image of $\operatorname{g}$. You can choose any non-surjective function $\operatorname{g}$ and $\operatorname{g}\circ \operatorname{f}$ will fail to be surjective.
Your example $\operatorname{g}(x) = \frac{1}{x}$ works fine since $\operatorname{g}$ misses $0$, i.e. there is no $x$ for which $\frac{1}{x}=0$. Other simple examples include $\operatorname{g}(x) = x^2$, $\operatorname{g}(x) = \operatorname{e}^x$ or even the constant function $\operatorname{g}(x) = 0$.