Question: Consider the following pseudocode, assuming dynamic scoping rules: 1 procedure main ( ) { 2 x : int : = 2 3 y : int
Consider the following pseudocode, assuming dynamic scoping rules:
procedure main
x : int :
y : int :
procedure increment n : int
if n
x : x
y : y
increment n
procedure decrement n : int
if n
x : x
y : y
decrement n
procedure two
y : int :
one decrement increment
procedure one f : procedure f : procedure m : int
x : int :
f m
f m
two
print x
print y
If the language uses deep binding, what will the output be Explain your answer.
If the language uses shallow binding, what will the output be Explain your answer.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
