Dear student,
The number of electrons present in K shell is 2.
The number of electrons present in L shell is 8.
The difference of electrons present in K and L shells is, 2-8=6.
Therefore, the number of electrons present is M shell is 6.
Hence, the atomic number of P is 16.
The ratio of P and Q is 1:2.
Therefore, the atomic number of Q is 2 x 16 = 32
Hence, the atomic number of Q is 32.
Regards