# Answered! Consider the following code: 1 int x, y: 2 void bar(int a) { 3 int k, q: 4 y = 2 * a: 5 a = a+ 1: 6 .. 7 } 8 void foo(int p: int…

Programming languages:

Don't use plagiarized sources. Get Your Custom Essay on
Answered! Consider the following code: 1 int x, y: 2 void bar(int a) { 3 int k, q: 4 y = 2 * a: 5 a = a+ 1: 6 .. 7 } 8 void foo(int p: int…
GET AN ESSAY WRITTEN FOR YOU FROM AS LOW AS \$13/PAGE

Consider the following code: 1 int x, y: 2 void bar(int a) { 3 int k, q: 4 y = 2 * a: 5 a = a+ 1: 6 .. 7 } 8 void foo(int p: int q) 9 float y, k: 10 bar(x): 11 y = 3: 12 .. 13 } 14 void baz() { 15 int m, n: 16 x = 5: m = 3: n = 2: 17 foo(m, n): 18 bar(x): 19 .. 20 } Assume execution of the code starts with line 14. A line number trace of this execution is: 15, 16, 17, 8, 9, 10, 2, 3, 4, 5, 6, 7, 11, 13, 18, 2, 3, 4, 5, 6, 7 This program could be executed using either Lexical (static) or Dynamic scoping. Describe the differences in variable binding and referencing for these two different executions. (i.e. first describe the Lexical case, then then Dynamic case using line numbers and variables). Be sure to state at what line in the execution Lexical vs. Dynamic scoping makes a difference.