(a) Calcium reacts vigorously with chlorine to form calcium chloride, which is an ionic chloride.
Ca(s) + Cl2(g) CaCl2(s)
(b) When magnesium reacts with very dilute nitric acid, it forms magnesium nitrate and hydrogen gas is evolved.
As the nitric acid is very dilute, it acts as a weak oxidising agent, which is unable to oxidise the hydrogen gas.
Mg(s) + 2HNO3(aq) Mg(NO3)2(aq) + H2(g)