The velocity of sound in a gas is given by $v =\sqrt{\gamma R T / M }$,
where $\gamma=$ ratio of specific heats at constant pressure and temperature,
$T =$ absolute temperature of the gas,
$M =$ molecular mass of the gas,
$R=$ gas constant,
At STP, temperature $T$ of both the given gases will be same, and as both the gases are diatomic so $\gamma$ is also same for both gases.
Now, molecular mass of Hydrogen $M _{ H }=2\, g\,mol ^{-1}$,
Molecular mass of Oxygen $M _{O}=32\, g\,mol ^{-1}$,
Hence, velocity of sound in Hydrogen $v_H =\sqrt{\gamma R T / 2}$
Velocity of sound in Oxygen $v_O =\sqrt{\gamma R T / 32}$,
Therefore, $v _{ O } / vH =\sqrt{32 / 2}=4 / 1$
i.e. $vO : vH =1: 4$
$\Rightarrow v _{ O }: v_H =4: 1$