The metal oxide is MgO sice the mass of magnesium is 24 g and mass of oxygen is 16 g.
Here, 40 g of MgO contains 16 g of Oxygen and hence, 4 g of MgO will contain 1.6 g of oxygen.
Since, Mg is a divalent metal, hence, the equivalent mass of Mg2+ is (24/2)g= 12 g