Answer: -
100 grams
Explanation: -
Mass of Oxygen = 40 g
Chemical formula of oxygen gas = O2
Molar mass of oxygen = 16 x 2 = 32 gram
Atomic mass of Mg = 24g
Molar mass of MgO = 24 x 1 + 16 x 1 =40 gram
The balanced chemical equation for the reaction is
2Mg + O2 -- > 2 MgO
So from the balanced equation we see that 1 O2 react to give 2 MgO
32 grams of O2 react to give 2 x 40 gram of MgO
40 grams of O2 react to give 
=100 gram of MgO