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:

Consider the following code: int x, y; 2 void bar int a t int k, q; a 1 S void foo(int p, int q) float y, k bar(x) 10 11 13 14 void bazo 15 int m, n 16 17 foo(m, n. 18 bar(x), 19 20 Assume execution ofthe code starts with line 14. Aline 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 Lexica 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

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
Order Essay

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.

Expert Answer

 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... 1Answered! 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... 2Answered! 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... 3Answered! 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... 4

Still stressed from student homework?
Get quality assistance from academic writers!