(b) 2
Atomic number of element X is 8.
Electronic configuration is 2, 6. It will gain 2 electrons to complete its octet; so, its valency is 2.
Atomic number of Y is 4.
Electronic configuration is 2, 2. It will lose 2 electrons in order to completely fill its outermost orbit . So, the valency of Y is also 2.