Answer
$p=\frac{1}{2}$ and $q=-\frac{1}{2}$
Work Step by Step
Dimension of T: [T].
Dimension of L: [L].
Dimension of g: $\frac{[L]}{[T]^{2}}$.
$2π$ has no dimensions.
$T=2πL^{p}g^{q}$
$[T]=[L]^{p}(\frac{[L]}{[T]^{2}})^{q}$
$[T]=\frac{[L]^{p+q}}{[T]^{2q}}$
$[T]^{1}\times [L]^{0}=[L]^{p+q}\times [T]^{-2q}$
$-2q=1$ and $p+q=0$
$-2q=1$
$q=-\frac{1}{2}$
$p+q=0$
$p-\frac{1}{2}=0$
$p=\frac{1}{2}$