Look both $f : A \rightarrow B$ and $g : B \rightarrow C $ are functions
for $f$, we can never be sure of injection, but for surjection you have to observe that, is it possible for some $a \in A$ to map to some $c \in C$ without mapping onto any $b \in B$ ?. surely this is not possible otherwise there would have been a $b \in B$ such that for $a \in A$, $ (a,b) \notin f$ and $(b,c) \in g$ we would have $(a,c) \notin fog$, which is not possible as $fog$ is surjective. Therefore we can conclude that $f$ is surjective.