Question: Based on the following code and knowing that Static scope rules apply; -List the variables that each program can access as well as what program/subprogram

Based on the following code and knowing that Static scope rules apply;

-List the variables that each program can access as well as what program/subprogram they are in.

-List this for sub1, sub2 and sub3

Below is an example of doing this for Main:

===================================

Program: main

Variables it can access (Variable declared in)

X (Declared in Main)

Y (Declared in Main)

Z (Declared in Main)

W (Declared in Main)

===================================

Do the above for Sub1, Sub2 and Sub3 in the below program:

-------------------------------------------------------------------------------------

proc main; var w, x, y, z;

proc sub1; var x, z; X := 6; Z := 7; x :=x + y * z; end sub1;

proc sub2; var w, x, y; w := 11; subl; end sub2;

proc sub3; var w; w := 1 O; x := w+x; y := x + z + 2; end sub3;

begin w := O; x := 1; y := 3; z := 5; sub2; sub3;

end main.

-------------------------------------------------------------------------------------

FILL IN THE BELOW CHART BASED ON ABOVE

-------------------------------------------------------------------------------------

===================================

Program: sub1

Variables it can access (Variable declared in)

===================================

Program: sub2

Variables it can access (Variable declared in)

===================================

Program: sub3

Variables it can access (Variable declared in)

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!