Which is right way to calculate percentage? A student gets the following marks. 

50   out of 100

120  out of 150

30   out of 50

In first method : I calculate the percentage as (sum of obtained marks) / (Total marks) * 100.
Hence [(50 + 120 + 30) / (100 + 150 + 50)] * 100 
     = (200 / 300) * 100 
     = 66.66%

In second method : I calculate individual percentages and divide by three as: 

(50% + 80% + 60%) / 3 = (190 / 3) = 63.33%

Why are the two percentages different and which one is the correct percentage?
First notice that the two results are close together, although you can probably create some strange case in which they aren't close.
Second there is no "right" answer.  Whoever creates the scoring scheme can decide how to combine the marks.
Third the two answers are the result of two different weighting schemes.  There are infinitely many such schemes.
Your first method would be correct. The cause for the difference between the two methods is that the second one doesn't take into account the differing amounts of total marks between assignments. This leads to an unequal weighting between assignments that are worth more or less than others. For an extreme example, say a student go the following marks:


2 out of 2 (100%)
20 out of 100 (20%)


The first method would give us a correct answer of $\frac{2+20}{2+100} \approx 21.57\%$.

The second method gives us an incorrect answer of $\frac{100+20}{2} = 60\%$