Answer:
The electronic configuration of the magnesium atom shows that it has two unpaired outermost shell electrons while that of oxygen shows that it has six outermost shell electrons with two of them unpaired.
By means of elecron transfer, magnesium atom donates its two electrons to the oxygen atom to now have a charge of +2 while the oxygen then has a charge of -2. This results in an ionic bonding between the two atoms.
Step-by-step explanation:
The structure is found in the attachment below