Why is the oxidation state of S +4 when sulfur reacts with H2SO4 while the oxidation state of S is +6 when it reacts with HNO3?
When sulfur reacts with concentrated sulfuric acid it is oxidized to sulfur dioxide as follows:
S + 2 H2SO4 à 3 SO2 + 2 H2O
Sulfur has an oxidation number of +6 in H2SO4. Note that because sulfur has an oxidation number of +6 in H2SO4, and went to an oxidation number of +4 in SO2, the sulfur in SO2 was reduced while the free sulfur, going from 0 to +4, was oxidized. This is called comproportionation, wherein one reactant atom, existing in two forms, reaches the same oxidation state in a single product through a reaction. This is the opposite of disproportionation where an element from a single reactant is both oxidized and reduced, showing up in two different reactants.
When sulfur reacts with nitric acid, as follows,
S + 6HNO3 à H2SO4 + 2 H2O + 6 NO2
Sulfur is oxidized from the zero oxidation state to +6. Nitric acid is an oxidizer, oxidizing sulfur first to SO2 then to SO3 which is essentially the anhydride of H2SO4.
Back to the first reaction: Sulfuric acid is capable of oxidizing elemental sulfur, as shown. This results is sulfur gaining oxygen as it did in the second reaction. However, it also results in the S in the acid being reduced as nitrogen was reduced in the second reaction when oxygen went from the oxyanion to the sulfur that was reduced.
This isn’t really related to the relative concentrations of the acid, it’s related to the relative tendencies of S and N to be reduced in the respective compounds. Although the first reaction only takes place in concentrated sulfuric acid. Sulfuric acid isn’t necessarily more concentrated than nitric acid. Both are strong acids which dissociate 100%, and sulfuric acid is diprotic so if concentrations of the two acids are equal then sulfuric acid will have a higher hydrogen ion concentration. However, nitric acid could be prepared at a concentration that has a higher hydrogen ion concentration than a given molarity of sulfuric acid.