Solution:
Concept: The M shell is the third shell. An atom with 2 electrons there loses them; an atom with 7 in its third shell gains one. Electrons are transferred, so an electrovalent compound forms.
Step 1 — Identify X and Y.
X is 2, 8, 2 (like magnesium) and loses 2 electrons; Y is 2, 8, 7 (like chlorine) and gains 1 electron.
Step 2 — (a) Write the formula.
One X2+ needs two Y− to balance its charge, so the formula is XY2 (like MgCl2).
Step 3 — (b) Noble gas configurations.
X2+ is 2, 8, like neon; Y− is 2, 8, 8, like argon.
Step 4 — (c) Orbital diagram.
X gives one electron (cross) to each of two Y atoms:

Watch out: The two ions reach different noble gases: X falls back to neon, Y moves up to argon.
Therefore, (a) the formula is XY₂, (b) X attains neon's configuration and Y attains argon's, and (c) the diagram shows X²⁺ between two Y⁻ ions.