when 5g of impure sample of CH4 is completely combusted, 9g of H2O was produced.what is the percentage purity of the sample of CH4

Molecular mass of CH4=12+4=16

Molecular mass of H2O=16+2=18
Use the combustion equation:
CH4+2O2=CO2+2H2O
or 16 grams of CH4 should produce 2*18=36 grams of H2O.

If there are only 9g of H2O produced, use proportions to calculate the mass of CH4 that produced the H2O, and hence the percentage purity.