Answer: Magnesium atom looses 2 electrons to obtain the noble gas structure.
Step-by-step explanation:
Atomic number of magnesium is 12. Electronic configuration of magnesium :
![[Mg]=1s^22s^22p^63s^2](https://img.qammunity.org/2018/formulas/chemistry/high-school/ntrw163imgmv8qpcrr3wczf5tgpun87p47.png)
In the periodic table, the nearest noble gas to magnesium element is Neon with atomic number 10.
![[Ne]=1s^22s^22p^6](https://img.qammunity.org/2018/formulas/chemistry/high-school/r5m0s6pkwnk2iyukqx50z63arnwhs7qwab.png)
So, in order to obtain noble gas electronic configuration the magnesium atom will loose 2 electrons.
![[Mg^(2+)]=1s^22s^22p^6](https://img.qammunity.org/2018/formulas/chemistry/high-school/8qmki24hr3zdvds2fqhoooe59gkkt2yv77.png)