GATE CSE C Programming Practice Test – Recursion | Set 1

Questions 31-35 of 100

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

Question 31

MCQ · Single Correct 1 mark

What is the space complexity of a recursive binary search on an array of size N?

Answers for question 31

Question 32

MCQ · Single Correct 1 mark

What happens when an accumulator parameter is used in a recursive function?

Answers for question 32

Question 33

MCQ · Single Correct 1 mark

What is printed by calling fun(100)?

C
void fun(int n) {
    if (n <= 0) return;
    fun(n - 25);
    printf("%d ", n);
}
Answers for question 33

Question 34

MCQ · Single Correct 2 mark

What is the output of the following C function for f(5)?

JAVASCRIPT
int f(int n) {
    if (n == 0) return 0;
    return n + f(n / 2);
}
Answers for question 34

Question 35

MCQ · Single Correct 1 mark

What is the output of the C function below when called as check(15, 20)?

JAVASCRIPT
int check(int a, int b) {
    if (a == b) return a;
    if (a > b) return check(a - b, b);
    return check(a, b - a);
}
Answers for question 35
Scroll to Top