The molar masses of hydrogen and oxygen are 2 g/mol and 64 g/mol respectively.
The number of moles of hydrogen =2g2g/mol=1mol.
The number of moles of oxygen =64g32g/mol=2mol.
The mole fraction of oxygen =22+1=23
The partial pressure of oxygen is the product of its mole fraction and total pressure. It is 23×3atm=2atm