Question: Consider the following JavaScript-like program: // main program var X, V, Z; function subl{() { var a, y, Z; function sub2 () { var a,

Consider the following JavaScript-like program: // main program var X, V, Z; function subl{() { var a, y, Z; function sub2 () { var a, b, z; function sub3() { var a, X, Z; } function sub4 () { var b, vy, z; function sub5{() { var a, b, w; Assume the calling sequence is main() -> sub4() -> sub5() -> sub1() -> sub1() -> sub2() -> sub3(). Draw a single run- time stack with activation record instances containing static and dynamic chain to answer and explain your answers for both questions 1 and 2. 1. List all the variables, along with the program units where they are declared, that are visible in the bodies of sub1, sub2, sub3, sub4, sub5, and main, assuming static scoping is used. Use a run-time stack explained above to get credit. (10 points)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
