Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. proc main int w, x, z; proc A: proc B; int x, z; { x := 2; call C; print x ; } (end

1.

proc main

int w, x, z;

proc A:

proc B;

int x, z;

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

proc C;

int w, a, z;

{ w := 4; x := 4; z := 7; call D; print w, x; } (end C)

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

proc D;

int x, b;

proc E;

int x;

{ x := 13; call F; print x; } (end E)

proc F;

proc G;

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

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

{ x := 6; w := 19; call E; print x; } (end D)

{ w:= 12; x:= 1; z := 9; call A; print w, x, z; } (end main)

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

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

(c) List the procedures that proc G can call (assuming static scoping).

(d) Specify the referencing environment (variables) of proc E (assuming static scoping)

(e) Specify the referencing environment (variables) of proc E (assuming dynamic scoping)

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

Database Processing Fundamentals Design And Implementation

Authors: KROENKE DAVID M.

1st Edition

8120322258, 978-8120322257

More Books

Students also viewed these Databases questions

Question

Summarize how productivity and technology are related.

Answered: 1 week ago