Step 1: Approach:
Use the rule that the sum of oxidation numbers equals the net charge, after fixing the known atoms.
Step 2: OF2:
F is $-1$ each, total $-2$. For zero net charge, O must be $+2$. It is positive because F pulls the shared electrons away from O.
Step 3: KO2:
K gives up one electron to form $\text{K}^+$. The two O atoms together must carry $-1$, so each is $-\frac{1}{2}$. That fractional value is the mark of a superoxide ion.
Final Answer:
Oxygen is $+2$ in $\text{OF}_2$ and $-1/2$ in $\text{KO}_2$, which is option (B).
\[ \boxed{+2\ \text{and}\ -\tfrac{1}{2}} \]