What is the amount of water produced when 2gram of hydrogen is ignited with 8gram of oxygen

This is a limiting reagent (LR) problem and you know that because amounts are listed for both reactants.

2H2 + O2 --> 2H2O
mols H2 = grams/molar mass = ?
mols O2 = grams/molar mass = ?

Use the coefficients in the balanced equation, to convert mols H2 to mols H2O.
Do the same to convert mols O2 to mols H2O.
It is likely these two values for mols will not agree; the correct value in LR problems is ALWAYS the smaller one and the reagent responsible for that is the LR.
Now use the smaller value and convert to grams (if you want the answer in grams and not mols).
grams = mols x molar mass.