To determine the number of moles of \( \text{O}_2 \) in 4.0 g of \( \text{O}_2 \), first establish the molar mass of \( \text{O}_2 \), which is \( 32 \, \text{g/mol} \). Then, calculate the moles of \( \text{O}_2 \) using the formula:
\[
\text{Moles of } \text{O}_2 = \frac{\text{Mass of } \text{O}_2}{\text{Molar mass of } \text{O}_2} = \frac{4.0 \, \text{g}}{32 \, \text{g/mol}} = 0.125 \, \text{mol}
\]
As each \( \text{O}_2 \) molecule comprises two oxygen atoms, the moles of oxygen atoms are calculated as:
\[
\text{Moles of oxygen atoms} = 2 \times 0.125 \, \text{mol} = 0.25 \, \text{mol}
\]
Consequently, 4.0 g of \( \text{O}_2 \) contains \( 0.25 \, \text{mol} \) of oxygen atoms.