if a sample of alloy containing magnesium and metal that doesn't react wtih hydrochloric acid are reacted, how much heat would be evolved from a 5 gram sample that is 30% magnesium?

Mg + 2HCl ==> MgCl2 + H2

Look up delta Hf for MgCl2 and HCl. Then
delta H rxn = (DHf MgCl2) - (2*DHf HCl).
heat evolved = DHrxn x (5*0.30/24.3