Question: Given the following: procedure Main is X:Integer; procedure Sub1 is begin -- of sub1 Put(x); end; -- of Sub1 procedure Sub2 is X: Integer; begin
Given the following:
procedure Main is
X:Integer;
procedure Sub1 is
begin -- of sub1
Put(x);
end; -- of Sub1
procedure Sub2 is
X: Integer;
begin -- of Sub2
X:= 5;
Sub1
end; -- of Sub2
begin of Main
X:= 10;
Sub2
End; -- of Main
- (2pts) Assume static scoping. What value of x is printed in procedure Sub1?
- b) (2pts) Now repeat assuming dynamic scoping
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
