Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Programming language concepts - 5 Please let me know if you need more time. Than

ID: 3758911 • Letter: P

Question

Programming language concepts - 5

Please let me know if you need more time. Thank you in advance.

There are two sample questions and answers bellow, hope it'd help.

Original question to answer

sample question and answer 1

sample question and answer 2

The following questions refer to the skeletal C++ program shown below. (b) Rente are at stat (b) Repeat part (a), but list the variables that are visible at Line 2. (c) Repeat part (a), but list the variables that are visible at Line 3. (a) Assume that static scoping is used. List all variables, along with the functions in which they are declared, that are visible at Line 1 in the program. (d) Repeat part (a), but list the variables that are visible at Line 4. (e) Repeat part (a), but list the variables that are visible at Line 5. () Assume that dynamic scoping is used, and that main calls £l, which calls £2, which calls f3. (Assume that f2 calls f3 on Line 4.) List all variables, along with the functions in which they are declared, that are visible at Line 5 in the program. void f1(O void f2) void f30 int a, b, c int main() int b, d; .. Line 1 id fl( int b, d Line 2 void £2() int c, e int b, c, d; ../ Line 3 ...// Line 4 void f3 () int b, f ...// Line 5 A sample answer to one part of the problem might look like this: a (global), c (declared in £2), d (declared in if block in f2)

Explanation / Answer

(a)
a(global), b(declared in main), c(global), d(declared in main)

(b)
a(global), b(declared in f1), c(global), d(declared in f1)

(c)
a(global), b(declared inside if block in f2), c(declared inside if block in f2), d(global)

(d)
a(global), b(global), c(declared in f1)

(e)
a(global), b(declared in f3), c(global), f(declared in f3)