The oxidation state of sulfur is VI because the net oxidation state is -II.
As oxygen is -II unless it is peroxide in which case it is -I.
You have
x+4(-II)=-II
x-VIII=-II
x=VI
Similarly for the second one, Hydrogen is +I etc.
Here are some rules you must know:
1. The oxidation state of a pure element eg O<sub>2</sub> is 0.
2. The oxidation state of an ion is equal to the net charge of that ion.
3. Oxygen always has an oxidation state of -II, except if it is in it's elemental form or a peroxide in which case it is -I.
4. Hydrogen has an oxidation state of -I in metal hydrides and an oxidation state of +I in non-metal hydrides.
They are only abstract concepts it really just allows the tracing of flow of electrons.
Oxidation is an increase in oxidation number.
Reduction is a decrease (or reduction) in oxidation number.