if 500 g of mgcl2 are produced in the above reaction how many l of h2 are produced

What above reaction? I'm guessing

Mg + 2HCl ==> MgCl2 + H2
mols MgCl2 = grams/molar mass = ?
mols H2 = mools MgCl2 (look at the coefficients in the balanced equation.)
You want L at STP; if at STP you know 1 mool H2 occupies 22.4L. So convert mols to L.