Exam 20: Recursion

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

When recursion is used on a linked list, it will always display the contents of the list in reverse order.

Free
(True/False)
4.9/5
(44)
Correct Answer:
Verified

False

The __________ algorithm uses recursion to sort a list.

Free
(Multiple Choice)
4.8/5
(38)
Correct Answer:
Verified

B

The QuickSort algorithm is used to sort

Free
(Multiple Choice)
4.8/5
(36)
Correct Answer:
Verified

A

In a recursive solution, the base case is always the first case to be called.

(True/False)
4.8/5
(28)

The recursive factorial function calculates the factorial of its parameter. Its base case is when the parameter is

(Multiple Choice)
4.8/5
(37)

A recursive function cannot call another function.

(True/False)
4.8/5
(26)

Like a loop, a recursive function must have some method to control the number of times it repeats.

(True/False)
4.9/5
(31)

The QuickSort algorithm was developed in 1960 by

(Multiple Choice)
4.9/5
(30)

If a recursive algorithm does not contain a base case, it

(Multiple Choice)
4.9/5
(35)

The QuickSort algorithm works on the basis of

(Multiple Choice)
4.8/5
(32)

A __________ function is one that calls itself.

(Multiple Choice)
4.7/5
(38)

The speed and amount of memory available to modern computers diminishes the performance impact of recursion so much that inefficiency is no longer a strong argument against it.

(True/False)
4.8/5
(31)

The following code is an example of a __________ recursive algorithm. int myRecursion(int array[], int first, int last, int val) { int num; if (first > last) \quad return -1; num = (first + last)/2; if (array[num] == val) \quad return num; if (array[num] < val) \quad return myRecursion(array, num + 1, last, val); else \quad return myRecursion(array, first, num - 1, val); }

(Multiple Choice)
4.7/5
(29)

Any algorithm that can be coded with recursion can also be coded with an iterative structure.

(True/False)
4.9/5
(40)

All mathematical problems are designed to be more efficient using recursive solutions.

(True/False)
4.7/5
(31)

Indirect recursion means that a function calls itself n number of times and then processing of the function starts from the first call.

(True/False)
4.9/5
(39)

Recursive algorithms are less efficient than iterative algorithms.

(True/False)
4.8/5
(26)

How many times will the following function call itself if 5 is passed as the argument? Void showMessage(int n) { \quad If (n > 0) \quad { \quad\quad Cout << "Good day!" << endl; \quad\quad ShowMessage(n - 1); \quad } }

(Multiple Choice)
4.8/5
(36)

How many times will the following function call itself if 5 is passed as the argument? void showMessage(int n) { \quad If (n > 0) \quad { \quad\quad cout << "Good day!" << endl; \quad\quad showMessage(n + 1); \quad } }

(Multiple Choice)
4.7/5
(31)

A recursive function is designed to terminate when it reaches its

(Multiple Choice)
4.9/5
(32)
Showing 1 - 20 of 27
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)