Your top example needs to be corrected from $$\require{cancel} \cancel{\dfrac{1}{2}+\dfrac{10}{30}=83.333\%}$$ to $$\frac12\left(\dfrac{1}{2}+\dfrac{10}{30}\right)=41.667\%;$$ this computes the simple average of the scaled scores of the various subjects.
In contrast, in your bottom example $$\frac{1+10}{2+30}\color{green}{=\frac2{32}\left(\dfrac{1}{2}\right)+\frac{30}{32}\left(\dfrac{10}{30}\right)}=34.375\%,$$ every mark in every subject is worth the same value; in other words, this is a different type of average score of the various subjects, this time each subject given a weightage corresponding to the total marks available in it.
A more illustrative example: say there are two Economics exam papers, Multiple-choice and Essay, in which you scored $55$ out of $60$ and $15$ out of $100,$ respectively. Then the simple average of the two scaled scores (every paper has the same score-worth) is $$\frac12\left(\frac{55}{60}+\frac{15}{100}\right)=53.3\%,$$ whereas the weighted average of the two scores (every mark has the same score-worth) is $$\frac{55+15}{60+100}\color{green}{=\frac{60}{160}\left(\dfrac{55}{60}\right)+\frac{100}{160}\left(\dfrac{15}{100}\right)}=43.75\%.$$
Neither average is more correct than the other; the choice of formula just depends on the assessment scheme.