In static scoping: 1
In dynamic scoping: 2
if call by reference is used then in static scoping when the function B is called inside the function A
the statement x= x+1 will change the global value of x = 5 6
but the main function is never using this global value of x it is printing the value of actual parameter y which is the formal parameter z in function A.
and z = 1, so, 1 will be printed in the case of static scope.
and when Dynamic scoping is used and the function B is called inside function A
the statement x= x+1 will change the value of the variable x present in the calling function i.e. A, so X= 1 2