Question: Considering the following skeletal program: program main; var x : integer; procedure sub 1 ; procedure sub 2 ; . . . end; { sub
Considering the following skeletal program:
program main;
var x : integer;
procedure sub;
procedure sub;
end; sub
end; sub
procedure sub;
var x : integer;
procedure sub;
var x : integer;
end; sub
end; sub
end; main
Assuming the following execution of the program:
main calls sub
sub calls sub
sub calls sub
sub calls sub
Assuming static scoping, state which declaration of x by line # is used to reference x in sub sub sub sub main
Do the same for dynamic scoping as well.
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
