Static scoping: Here if a variable is not in local scope, it is looked in global scope.
So, b in func() is the global b. So, 10 is printed. a is incremented by 10 when x = x + b, (due to pass by reference) and a is again incremented by 10 when y = y + b. So, print(a) will print 30.
Dynamic scoping: Here if a variable is not in local scope, it is looked in the function which called the current one.
So, b in func() is the b from main. So, 20 is printed and a is incremented two times by 20 and final print(a) will print 10 + 20 + 20 = 50.