Question: (a) What does this program print if the language uses static scoping? (b) What does it print if the language uses dynamic scoping with deep
(a) What does this program print if the language uses static scoping? (b) What does it print if the language uses dynamic scoping with deep binding? (c) What does it print if the language uses dynamic scoping with shallow binding?

1 x integer 3 procedure set-x (n integer 6 procedure print-x write-integer (x) 9 procedure foo (S,P function n integer) x integer 0 10 if n in 12,3 12 set -x (n) 13 else S(n) 14 if n in 13,4 15 16 print -x 17 else 18 19 20 set-x (4); foo (set-x print-x,1); prin t-x 21 set -x (0); foo (set-x print-x ,2); print-x 22 set-x (1); foo (set-x print-x,3); print-x 23 set-x (3); foo (set-x print x ,4); print-x
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
