The function $f\circ g$ has domain $X$ and codomain $T$, i.e., $f\circ g: X \rightarrow T$.
For question (a), we are given that $f\circ g$ is onto. This means that everything in $T$ gets mapped to, i.e. for all $t \in T$, there exists some $x\in X$ such that $f\circ g(x) =t$.
Can this happen without $g$ being onto? Pause here and try out some example functions, they can be functions on the reals or functions between small sets. Pause here before reading on.
Unpause: Were you able to find a counterexample? If not, here's a hint: let $T$ have only one element. Remember: a counterexample is all you need to disprove something.
For (b), we again have that $f\circ g$ is onto. However, we are now asked if $f$ must be onto? In this situation, start by writing an example where $f$ is not onto, and see if you can make $f\circ g$ onto. Once you've convinced yourself this is a futile task, you're ready to move on to proving that $f$ must be onto.
We can do a proof by contradiction: we show that if $f$ is not onto, then $f\circ g$ is not onto [you can think of this as the contrapositive too, I'm not sure which you're more comfortable with, but it's effectively the same here]. If $f$ is not onto, that must mean there is an element $t' \in T$ to which no element in $Y$ maps under the function $f$. I'll leave you here: Given what we know, could we possibly find an element in $X$ that gets mapped to some element in $Y$ by $g$ and then gets mapped to $t'$ by $f$?