<u>Answer:</u> The chemical formula for the ionic compound formed will be 
<u>Explanation:</u>
Magnesium is the 12th element of the periodic table having electronic configuration of ![[Ne]3s^{2}](https://tex.z-dn.net/?f=%5BNe%5D3s%5E%7B2%7D)
This element will loose 2 electrons and thus shows an oxidation state of +2 units.
Oxygen is the 8th element of the periodic table having electronic configuration of ![[He]2s^22p^4](https://tex.z-dn.net/?f=%5BHe%5D2s%5E22p%5E4)
This element requires 2 electrons and thus shows an oxidation state of -2 units.
By criss-cross method, the oxidation state of the ions gets exchanged and hence, they form the subscripts of the opposite ion. This results in the formation of a neutral compound.
Thus, the chemical formula for the ionic compound will be 