Let the mass of H2 in the mixture be w g. Then, the mass of O2 will be 4w g.
The molar mass of H2 is 2 g mol−1 and the molar mass of O2 is 32 g mol−1 .
Number of moles is calculated as the ratio of given mass to the molar mass .
Number of moles of H2=Molar mass of H2Mass of H2=2w
Number of moles of O2=Molar mass of O2Mass of O2=324w=8w
The molar ratio of H2 to O2=8w2w=28=14=4:1.