What will be the mass of water if 5gms of hydrogen and 8gms of oxygen react with each other?

Way too much H2

H2O = 2 + 16 = 18 grams/mol

that is 16 g/mol of O

so 8 g is 1/2 mol of O

H2 is 2 g/mol so 5g is 2.6 mol,
more than we need

so we end up with 1/2 mol of water
which is 9 grams