\(n_{Mg}=\dfrac{2.4}{24}=0.1\left(mol\right)\)
\(Mg+2HCl\rightarrow MgCl_2+H_2\)
\(0.1....................................0.1\)
\(V_{H_2}=0.1\cdot22.4=2.24\left(l\right)\)
\(2H_2+O_2\underrightarrow{^{t^0}}2H_2O\)
\(0.1.....0.05\)
\(m_{O_2\left(dư\right)}=\left(0.5-0.05\right)\cdot32=14.4\left(g\right)\)