Answer:
2 electrons will be needed by unbound oxygen in order to fill its 2nd shell.
Step-by-step explanation:
The chemical reaction between magnesium and oxygen gives magnesium oxide as a product.The reaction is chemically represented as:

Magnesium is a metal of group-2 with 2 valence electrons.It has atomic number of 12.
![[Mg]=1s^22s^22p^63s^2](https://img.qammunity.org/2020/formulas/chemistry/high-school/7bsafw9fxy7dufmh69ucr6i8se25wlejlv.png)
In order to attain noble gas configuration it will loose two electrons.
![[Mg]^(2+)=1s^22s^22p^6](https://img.qammunity.org/2020/formulas/physics/high-school/98dim3ffly532iky3lj0zid080iwq4dzql.png)
...[1]
Oxygen is a non metal of group-16 with 6 valence electrons..It has atomic number of 8.
![[O]=1s^22s^22p^4](https://img.qammunity.org/2020/formulas/chemistry/high-school/b1p9l8rvjz0s6smf1yzenvexrdu81rit9d.png)
In order to attain noble gas configuration it will gain two electrons.
![[O]^(2-)=1s^22s^22p^6](https://img.qammunity.org/2020/formulas/physics/high-school/8chyvjiszxwe215utcebxlcfw0c4csci76.png)
..[2]
2 electrons will be needed by unbound oxygen in order to fill its 2nd shell.