The correct option is D Y is a non-metal and Z is a metal
Generally, metals have a lesser number of electrons in their outermost shell which can be a maximum of three. So, from the given compounds Y cannot be a metal and X has a complete electronic configuration in the valence shell and is not a metal. When the number of valence electrons is less than or equal to 4, the valency is equal to valence electrons and when valence electrons > 4, then valency =(8−4).
X- 2, 8; is a noble gas (Ne) with a valency of 0.
Y-2, 8, 7; is a non-metal or halogen (Cl) with a valency of 8−7=1.
Z-2, 8, 2; is a metal (Mg) with a valency of 2.