Answer
Please see the work below.
Work Step by Step
We know that the number of orbitals in the g sub shell (l=4) can be determined as $2l+1$ and so it is equal to 9 as each orbital is able to hold a maximum of two electrons. Hence, the sub shell g can hold a maximum of eighteen electrons.