It is easy to prove that
$g\circ f\;$ is one-one $\implies f\;$ is one-one.
$g\circ f\;$ is onto $\implies g\;$ is onto.
Consequently,
since $\;\left(g\circ f\right)^{-1}$ exists, then $\;g\circ f\;$ is one-one and onto, hence $\;f\;$ is one-one and $\;g\;$ is onto.
So the correct answer is $(2)$.
Addendum .
Claim 1 :$\quad g\circ f\;$ is one-one $\implies f\;$ is one-one.
Proof : $\;$ Let $\;a_1\;$ and $\;a_2\;$ be two elements of the set $\;A\;.$
$f(a_1)=f(a_2)\;$ implies that $\;(g\circ f)(a_1)=(g\circ f)(a_2)\;$ and, since $\;g\circ f\;$ is one-one, we get that $\;a_1=a_2\;.$
So we have proved that $f(a_1)=f(a_2)\;$ implies $\;a_1=a_2\;,\;$ consequently $\;f\;$ is one-one.
Claim 2 :$\quad g\circ f\;$ is onto $\implies g\;$ is onto.
Proof : $\;$ Since $\;g\circ f\;$ is onto, it follows that
for any $\;c\in C\;$ there exists $\;a\in A\;$ such that $\;(g\circ f)(a)=c\;,$
consequently,
for any $\;c\in C\;$ there exists $\;b=f(a)\in B\;$ such that $\;g(b)=(g\circ f)(a)=c\;,$
hence $\;g\;$ is onto.