Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Illuminated

Authors: Catherine M. Ricardo

1st Edition

0763733148, 978-0763733148

More Books

Students also viewed these Databases questions

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago