Question: 1. If this language has static scoping, what is the output of this program? If this language has dynamic scoping, what is the output of

1. If this language has static scoping, what is the output of this program? If this language has dynamic scoping, what is the output of this program?

1. If this language has static scoping, what is the output of

Please explain the steps

Consider the following program in a C-like language that allows nested procedures. For static scoping, assume that a declaration is in force from the point it appears until the end of the block in which it appears. For dynamic scoping, assume that declarations are encountered during execution in the order they appear within a procedure. void main() int z = 10; void g() int x = 12; int y = 3; // location A void f() z = x*y; printLine(x, y, z); // location B void h() // locationc int y = 2; int z = 5; x = y+z; printLine(x, y, z) f(); h(); printLine(x, y, z); g ; // location D Consider the following program in a C-like language that allows nested procedures. For static scoping, assume that a declaration is in force from the point it appears until the end of the block in which it appears. For dynamic scoping, assume that declarations are encountered during execution in the order they appear within a procedure. void main() int z = 10; void g() int x = 12; int y = 3; // location A void f() z = x*y; printLine(x, y, z); // location B void h() // locationc int y = 2; int z = 5; x = y+z; printLine(x, y, z) f(); h(); printLine(x, y, z); g ; // location D

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!