Step 1: Understanding the Concept:
Oxidation state is the charge an atom would have if all bonds were ionic. Oxygen is usually \(-2\), but it changes when bonded to fluorine or in peroxides and superoxides.
Step 2: In \(\text{OF}_2\):
Fluorine is the most electronegative element and is always \(-1\). The molecule is neutral:
\[ x + 2(-1) = 0 \Rightarrow x = +2 \]
Step 3: In \(\text{KO}_2\):
Potassium is \(+1\), so the anion is \(\text{O}_2^{-}\), a superoxide. Let the oxidation state of oxygen be \(y\):
\[ +1 + 2y = 0 \Rightarrow y = -\tfrac{1}{2} \]
Step 4: Conclusion:
The two values are \(+2\) and \(-1/2\). Option A (\(+1\) for \(\text{KO}_2\)) is wrong because K, not O, carries \(+1\). Option C gives \(+1\) to \(\text{OF}_2\) and ignores the two fluorines. Option D is the usual value of oxide and peroxide oxygen.
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}} \]