The key thing about this question is that it states the elements have consecutive atomic numbers.
Assuming the period doesn't change, which it could, but based upon the questions asked seems unlikely:
As one of them is an inert gas (that being B due to it having the greatest first ionisation energy) then the others must be a part of group 7 (that being A - next highest ionisation energy), group 6 (D for the same reason as previous) and group 5 (for the same reason as the other two).
Thus, X is evidently the halogen, so is A.
Y is a compound that bonds to two hydrogen atoms - group 6 elements are elements which regularly do this e.g H2O. Thus, Y must be D.