(a) The charge is outside the cube, so the cube encloses no charge. By Gauss's law,
Φcube=0
Every field line that enters the cube also leaves it.
(b) Imagine a second cube of side a built directly on top of the first, sharing its top face. The charge is 2a above the centre of the shared face — so it is exactly at the centre of this imaginary upper cube.

For the upper cube, each of its six faces carries 6ε0q outward (from the upper cube). For the shared face, "outward from the upper cube" means downward, into our cube. So for our cube this flux is inward, i.e. negative:
Φtop=−6ε0q
(c) The total for our cube is zero (part (a)), so the other five faces together carry
Φfive faces=0−(−6ε0q)=+6ε0q
outward — the field lines that enter through the top leave through the other five faces.