GATE CSE C Programming Practice Test – Recursion | Set 1

Questions 66-70 of 100

Your score 0/100 0 answered
Correct 0 Incorrect 0 Unanswered 100 Accuracy 0%

Question 66

MCQ · Single Correct 1 mark

What is the recursion base case in the binary search algorithm?

Answers for question 66

Question 67

MCQ · Single Correct 2 mark

What is the output of calling show(3)?

C
#include <stdio.h>
void show(int n) {
    if (n <= 0) return;
    show(n - 1);
    show(n - 1);
    printf("%d ", n);
}
Answers for question 67

Question 68

MCQ · Single Correct 1 mark

What is the complexity of computing Fibonacci numbers recursively without memoization?

Answers for question 68

Question 69

MCQ · Single Correct 1 mark

What is the output of the following C program?

C
#include <stdio.h>
int f(int n) {
    if (n == 0) return 0;
    return n + f(n - 1);
}
int main(void) {
    printf("%d", f(10));
    return 0;
}
Answers for question 69

Question 70

MCQ · Single Correct 1 mark

In C, what occurs if a recursive function modifies a global variable?

Answers for question 70
Scroll to Top