Answer:
Refer to the explanation section
Explanation:
a) The main function invokes fun1; fun1 then calls fun2, followed by fun2 calling fun3.
fun3() d, e, f
fun2() c, d, e
fun1() b, c, d
main() a, b,c
CALL STACK INDICATING VARIABLES OF EACH FUNCTION
The preceding call stack diagram clearly indicates that the last function called is fun3().
Within fun3(), the local variables "d, e, f" are available.
The variable "c" from fun2() can also be accessed.
The variable "b" belonging to fun1() remains visible.
Finally, the variable "a" from main() is also visible.
b) Here, main invokes fun1, which then calls fun3.
fun3() d, e, f
fun1() b, c, d
main() a, b,c
CALL STACK SHOWING VARIABLES FOR EACH FUNCTION
Again, the previous call stack clearly shows that fun3() is the last function executed.
The local variables in fun3() include "d, e, f".
The accessible variables from fun1() are "b, c".
Variable "a" from main() is also retrievable.
c) The main function calls fun2, which calls fun3, and fun3 in turn calls fun1.
fun1() b, c, d
fun3() d, e, f
fun2() c, d, e
main() a, b,c
CALL STACK ILLUSTRATING THE VARIABLES IN EACH FUNCTION
The last function call evident from the diagram is to fun1().
In fun1(), the visible local variables are "b, c, d".
The visible variables "e, f" are from fun3().
The variable available from main() is "a".
d) The main function invokes fun1, which calls fun3, and lastly, fun3 invokes fun2.
fun2() c, d, e.
fun3() d, e, f
fun1() b, c, d
main() a, b,c
CALL STACK SHOWING VARIABLES WITHIN EACH FUNCTION
From the call stack, it's evident that the final function call is made to fun2().
In fun2(), local variables "c, d, e" can be accessed.
Variables "f" from fun3() and "b" from fun1() remain visible.
Finally, variable "a" from main() is also visible.
The ultimately called function will include all of its own local variables and the variables from all preceding function calls up to the main function.