Please provide work with solution. Concepts of programming languages Sebesta 11
ID: 3677558 • Letter: P
Question
Please provide work with solution. Concepts of programming languages Sebesta 11 ed Chapter 5
Consider the following skeletal C program void funi (void prototyp void fun2(void prototyp void fun3 (void prototyp void main int x, y, z; void fun1(void) int a, y, z: void fun2(void) int a, b, z: void fun3(void) int a, x, w: en the following calling sequences and assuming that dynamic scoping is used, what ables are visible during execution of the last subprogram activated? Include with each visible able the name of the function in which it was defined. a. main calls funi: fum1 calls fun2: fun2 calls fun3. b. main calls funi: fumi calls fun3 c. main calls fun2: fun2 calls fun3: fun3 calls fun1. d. main calls fun3: fun3 calls funl e. main calls funi: fum1 calls fun3: fun3 calls fun2. f. main calls fun3: fun3 calls fun?: fun2 calls fun1.Explanation / Answer
Hi below i have written the solution for your reference,
a. Main call fun1; fun1 calls fun2; fun2 calls fun3.
Answer: Variables that are visible at the last function call:
x ------------- defined in main
a ------------- defined in fun1
a ------------- defined in fun2
a, x, w ------------- defined in fun3
b. Main call fun1; fun1 calls fun3.
Answer:
Variables that are visible at the last function call:
x ------------- defined in main
a, y ------------- defined in fun1
a, x, w ------------- defined in fun3
c. Main calls fun2; fun2 calls fun3; fun3 calls fun1.
Answer:
Variables that are visible at the last function call:
x ------------- defined in main
x, w ------------- defined in fun3
a, y, z ------------- defined in fun1
d. Main calls fun3; fun3 calls fun1.
Answer:
Variables that are visible at the last function call:
x ------------- defined in main
x, w ------------- defined in fun3
a, y, z ------------- defined in fun1
e. Main calls fun1; fun1 calls fun3; fun3 calls fun2.
Answer:
Variables that are visible at the last function call:
x ------------- defined in main
a ------------- defined in fun1
w ------------- defined in fun3
a, b, z ------------- defined in fun2
f. Main calls fun3; fun3 calls fun2; fun2 calls fun1
Answer:
Variables that are visible at the last function call:
x ------------- defined in main
w ------------- defined in fun3
z ------------- defined in fun2
a, y, z ------------- defined in fun1
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.