Dear student
When 3g of Mg is burnt in 2g of O2, 5g of MgO is produced
Mg + O2 ---> MgO
Thus this in in accordance with Law of conservation of mass as total mass of reactants = Mass of the product
So when 3g of Mg is burnt in 5.04g of O the mass of MgO formed will be: 3g + 5.04 = 8.04g
Regards