Oxidation state of oxygen in KO2 is :
It has only one electron in its valence shell and can only take the +1 oxidation state.
Now, in KO2, let oxidation number of oxygen be x.
Therefore, 1+2x=0 as K=+1 and KO2 is a neutral molecule.
The oxidation number of oxygen in KO2 is −12