VOOZH about

URL: https://www.geeksforgeeks.org/quizzes/top-mcqs-on-recursion-algorithm-with-answers/

⇱ Quiz about Recursion Quiz


Last Updated :
Discuss
Comments

Question 1

Consider the following C function. 

The return value of fun(5) is __________.

  • 0

  • 26

  • 51

  • 71

Question 2

Consider the below program, what operation is performed below:

  • Insertion Sort Recursively

  • Bubble Sort Recursively

  • Selection Sort Recursively

  • None

Question 3

Match the pairs in the following questions: 

List 1List 2
A. Recursion1. Sorted Array
B. Binary Seach2. Recursion
C. Sorting3 Base case
D. Dynamic Programming4.O(NlogN)
  • A – 2, B – 1, C – 4, D – 3

  • A – 3, B – 4, C – 1, D – 2

  • A – 3, B – 1, C – 4, D – 2

  • A – 2, B – 4, C – 1, D – 3

Question 4

Consider the below Program and identify the problem:


  • Selection Sort Recursive implementation

  • Bubble sort Recursive implementation

  • Finding Pair Recursive implementation

  • None of these

Question 5

What is the output of the following code for the input arr[]={1,2,3,4,5,6} N=6?

  • 21

  • 0

  • Runtime error

  • None

Question 6

What is the output of the below program for the tree:

👁 Image
Tree
  • 1 2 3 4 5 

  • 1 3 4 5 2

  • 4 2 5 1 3

  • 5 4 3 2 1

Question 7

What is the name of below recursive program?

  • N Queen Problem

  • Tower of Hanoi

  • M coloring Problem

  • None

Question 8

What is the output of the following program? 

  • 1 7
    2 6
    3 5
    4 4
    4 4

  • 1 7
    2 6
    3 5
    4 4

  • 1 7
    2 6
    3 5

  • 1 2
    3 4
    5 6
    7 8

Question 9

Consider the code fragment below : 

What does f(173) print?

  • 010110101

  • 010101101

  • 10110101

  • 10101101

Question 10

The function f is defined as follows: 

Assuming that arbitrarily large integers can be passed as a parameter to the function, consider the following statements.
1. The function f terminates for finitely many different values of n ≥ 1. 
ii. The function f terminates for infinitely many different values of n ≥ 1. 
iii. The function f does not terminate for finitely many different values of n ≥ 1. 
iv. The function f does not terminate for infinitely many different values of n ≥ 1. 
Which one of the following options is true of the above?

  • (i) and (iii)

  • (i) and (iv)

  • (ii) and (iii)

  • (ii) and (iv)

There are 30 questions to complete.

Take a part in the ongoing discussion