What is the output? int f(int n) {
What is the output?
int f(int n) {
if (n <= 1) return 1;
return n * f(n - 1);
}
printf("%d", f(5));
Show answerHide answer
Correct answer: (B) 120
Explanation
f computes factorial: 5! = 120.
Correct answer: (B) 120
Explanation
f computes factorial: 5! = 120.
This is question 132 of DSSSB TGT Computer Science Full Mock Test 1. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.