Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following code in a language that permits nested subprograms. subprog sub0() { var a, b, c; subprog sub1() var c; subprog sub2() {

Consider the following code in a language that permits nested subprograms.

subprog sub0() { var a, b, c; subprog sub1() var c; subprog sub2() { var a; a = 7; b = 14; c = 21; } //sub2 a = 5; b = 10; c = 15; sub2(); } //sub1 subprog sub3() { var b; a = 4; b = 8; c = 12 sub1(); } //sub3 a = 1; b = 2; c = 3; sub3(); } //sub0 

for the program above I need to find the values of a, b, and c using static scoping and dynamic scoping. The answers should be:

Static Scoping: a = 5 b = 14 c = 12

Dynamic Scoping: a = 5 b = 2 c = 12

I have looked at the code over and over again and I just cannot comprehend how to do this. Can anyone please walk me through the steps clearly so that I can learn to do this?

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

Beginning VB.NET Databases

Authors: Thearon Willis

1st Edition

1594864217, 978-1594864216

More Books

Students also viewed these Databases questions

Question

Understand the concept and implementation of a confusion matrix

Answered: 1 week ago

Question

Q.No.1 Explain Large scale map ? Q.No.2 Explain small scale map ?

Answered: 1 week ago

Question

1. Signs and symbols of the map Briefly by box ?

Answered: 1 week ago

Question

Types of physical Maps?

Answered: 1 week ago