-
Consider the following two functions.
The output printed when funl (5) is called is
-
- 53423122233445
- 53423120112233
- 53423122132435
- 53423120213243
- 53423122233445
Correct Option: C
In the given program, when the function fun 1() is calling function fun 2 (), after printing value and after returning from fun 2 (), it prints the same value. In the function fun 2 () also the same thing happens so by looking options we can find the correct sequence of the output after executing fun1 (5), (n = 5), fun1 (n), print ⇒ 5.
fun2 (n – 2) ⇒ fun2 (3), Print ⇒ 3.
Similarly all steps execute then, we get the correct. Sequence is 5 3 4 2 3 1 2 2 1 3 2 4 3 5 Hence, option (c) is correct.