Question: 9. (10pts) Consider the following program, written in JavaScript-like syntax: // main program var x, y, Zi function sub10) { var a, y, 2; }
9. (10pts) Consider the following program, written in JavaScript-like syntax: // main program var x, y, Zi function sub10) { var a, y, 2; } function sub20 { var a, b, z; function sub3() { var a, X, W } Given the following calling sequences and assuming that dynamic scoping is used, what variables are visible during execution of the last subprogram activated? Include with cach visible variable the name of the unit where it is declared, (a) main calls subl; sub1 calls sub2; sub2 calls sub3. (b) main calls subl; subl calls sub3. (c) main calls sub2; sub2 calls sub3; sub3 calls sub1. (d) main calls sub3; sub3 calls subl. (e) min calls subl: subl calls sub3; sub3 calls sul2. (!) main calls sub3; sub3 calls sub2; sub2 calls subi 9. (10pts) Consider the following program, written in JavaScript-like syntax: // main program var x, y, Zi function sub10) { var a, y, 2; } function sub20 { var a, b, z; function sub3() { var a, X, W } Given the following calling sequences and assuming that dynamic scoping is used, what variables are visible during execution of the last subprogram activated? Include with cach visible variable the name of the unit where it is declared, (a) main calls subl; sub1 calls sub2; sub2 calls sub3. (b) main calls subl; subl calls sub3. (c) main calls sub2; sub2 calls sub3; sub3 calls sub1. (d) main calls sub3; sub3 calls subl. (e) min calls subl: subl calls sub3; sub3 calls sul2. (!) main calls sub3; sub3 calls sub2; sub2 calls subi
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
