ISRO | ISRO CS 2017 | Question 73
Consider the function
int fun(x: integer) { If x > 100 then fun = x – 10; else fun = fun(fun(x + 11)); }
For the input x = 95, the function will return
(A) 89
(B) 90
(C) 91
(D) 92
Answer: (C)
Explanation: f(95)–>f(f(106)) = f(96)–>f(f(107)) = f(97)–>f(f(108)) = f(98)–>f(f(109)) = f(99)–>f(f(110)) = f(100)–>f(f(111)) = f(101) = 91
So the correct option is (C)
Quiz of this Question
Please Login to comment...