Question: Consider the following quasi-Javascript code:var x;function sub1() {print(x)x = 20}function sub2() {var x;x = 40;sub1();}x = 9;sub2();a)If this code were run with static scoping, what

Consider the following quasi-Javascript code:var x;function sub1() {print(x)x = 20}function sub2() {var x;x = 40;sub1();}x = 9;sub2();a)If this code were run with static scoping, what value would be printed?b)If this code were run with dynamic scoping, what value would be printed?

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!