Answer:
See below.
Step-by-step explanation:
An oxygen atom, in free state has 8 electrons, 2 in the first shell, and 6 in the second. It can only achieve stability if the valency of the valence shell is 0. In order for this, it combines with another atom with the same valency, such as magnesium or another oxygen atom to obey the octet rule. Hope it helps.