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:= 10;

Sub1

end; -- of Sub2

begin of Main

X:= 5;

Sub2

End; -- of Main

  1. Assume static scoping. What value of x is printed in procedure Sub1?

b. Now repeat assuming dynamic scoping

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!