Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following program: In each case YOU MUST SHOW ALL OF YOUR WORK proc main int x, z; proc A: int a; proc B;

Consider the following program:

In each case YOU MUST SHOW ALL OF YOUR WORK

proc main

int x, z;

proc A:

int a;

proc B;

int x, a;

{ x := 2; a:= 8; call C; print x; } (end B)

proc C;

int z;

{ x := 4; z := 7; print a; } (end C)

{ x := 3; z := 5; a:= 6; call B; print x; } (end A)

proc D;

int x, b;

proc E;

int x, z;

{ x := 5; z:= 11; call F; print x; } (end E)

proc F;

proc G;

{ print z; x:= 8; call A; print x; } (end G)

{ print x; call G; x:=7; } (end F)

{ x := 12; call E; print x; } (end D)

{ x:= 1; z := 9; call D; print x; } (end main)

(a) (6pts) What is the program output assuming static scoping rules are employed?

(b) (6pts) What is the corresponding output when dynamic scoping rules are employed?

(c) (5pts) List all of the units (proc's) that proc C can call (assuming static scoping).

(d) (4pts) Specify the referencing environment of proc F (assuming static scoping)

That is, list the variables that are visible to proc F

(e) (4pts) Specify the referencing environment of proc F (assuming dynamic scoping)

That is, list the variables that are visible to proc F image text in transcribed

proc main int x, z; proc A: inta; "proc-B: int x, a; { x:=2; a:=:8; call C; print x; } (end B) proc C - int z; { x:=4; :=7; print a; } (end C4 { x:=-3; 2:=5; a:=6; call:B; print x; }(end A4 proc D: int x, b; proc E: int-X, Z; { x:=-5; Z:=11; call F; print x; } (end-E) proc F:- proc G; {print z; x:= 8; call A; print x; } (end 6) {print x; call G; x:=7;-} (end-F) {x:=12; call E; print x; } (end D) ...... { x:=-1; Z:=-9; call:D; print x; } (end main) (a) (opts) What is the program output assuming static scoping rules are employed? (b) (Opts) What is the corresponding output when dynamic scoping rules are employed? () (5pts) List all of the units (proc's) that proc C can call (assuming static scoping). (d) (4pts) Specify the referencing environment of proc F (assuming static scoping) .......That is, list the variables that are visible to proc F (e) (4pts) Specify the referencing environment of proc F (assuming dynamic scoping) ........ That is, list the variables that are visible to proc F4 proc main int x, z; proc A: inta; "proc-B: int x, a; { x:=2; a:=:8; call C; print x; } (end B) proc C - int z; { x:=4; :=7; print a; } (end C4 { x:=-3; 2:=5; a:=6; call:B; print x; }(end A4 proc D: int x, b; proc E: int-X, Z; { x:=-5; Z:=11; call F; print x; } (end-E) proc F:- proc G; {print z; x:= 8; call A; print x; } (end 6) {print x; call G; x:=7;-} (end-F) {x:=12; call E; print x; } (end D) ...... { x:=-1; Z:=-9; call:D; print x; } (end main) (a) (opts) What is the program output assuming static scoping rules are employed? (b) (Opts) What is the corresponding output when dynamic scoping rules are employed? () (5pts) List all of the units (proc's) that proc C can call (assuming static scoping). (d) (4pts) Specify the referencing environment of proc F (assuming static scoping) .......That is, list the variables that are visible to proc F (e) (4pts) Specify the referencing environment of proc F (assuming dynamic scoping) ........ That is, list the variables that are visible to proc F4

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_2

Step: 3

blur-text-image_3

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

Database Administration The Complete Guide To Dba Practices And Procedures

Authors: Craig S. Mullins

2nd Edition

0321822943, 978-0321822949

More Books

Students also viewed these Databases questions

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago