Question: function fun1() { // The main program var a=8; function fun2() { var w=10; var a=4; function fun3() { var c = a; document.write(a); .
function fun1() { // The main program var a=8; function fun2() { var w=10; var a=4; function fun3() { var c = a; document.write(a); . . . } document.write(w); document.write(a); } function fun4() { var b = a; . . . document.write(w); } } Assume that the execution of this program (i.e. the calling sequence) is in the following unit order: fun1 -> fun2 -> fun3 -> fun4
(a). Assuming static scoping, which declaration of a is the correct one for a reference to a in fun2? (b). Assuming static scoping, which declaration of a is the correct one for a reference to a in fun3? (c). Assuming static scoping, which declaration of a is the correct one for a reference to a in fun4? (d). Assuming static scoping, which declaration of w is the correct one for a reference to w in fun4? (e). Assuming static scoping, which declaration of w is the correct one for a reference to w in fun3? (f). Assuming static scoping, which declaration of w is the correct one for a reference to w in fun2? (g). Assuming static scoping, which declaration of b is the correct one for a reference to b in fun4? (h). Assuming static scoping, which declaration of b is the correct one for a reference to b in fun3? (i). Assuming static scoping, which declaration of b is the correct one for a reference to b in fun2?
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
