Question: Problem 3 [6pt] Consider the following pseudo-code with higher-order function support. Assume that the language has one scope for each function, and it allows nested

 Problem 3 [6pt] Consider the following pseudo-code with higher-order function support.

Problem 3 [6pt] Consider the following pseudo-code with higher-order function support. Assume that the language has one scope for each function, and it allows nested functions (hence, nested scopes). In the pseudo code, declarations with type "int are local declarations; otherwise the variables not declared locally are referring to the outer level of function. function A() { int x = 5; function C(P) { int x = 3; P(); } function D() { print x; } function B() { int x = 4; C(D); } B(); } A() a) (1pt) What would the program print if this language uses dynamic scoping and shallow binding (binding happens when the function is called)? b) (4pt) Justify your answer by showing the tree of symbol tables when execution reaches the display expression. c) (1pt) What would the program print if this language uses static/lexical scoping

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!