Exam 20: Recursion
Exam 1: Introduction to Computers and Programming47 Questions
Exam 2: Introduction to C62 Questions
Exam 3: Expressions and Interactivity45 Questions
Exam 4: Making Decisions51 Questions
Exam 5: Loops and Files60 Questions
Exam 6: Functions49 Questions
Exam 7: Arrays and Vectors56 Questions
Exam 8: Searching and Sorting Arrays30 Questions
Exam 9: Pointers47 Questions
Exam 10: Characters, C-Strings, and More About the String Class47 Questions
Exam 11: Structured Data46 Questions
Exam 12: Advanced File Operations38 Questions
Exam 13: Introduction to Classes54 Questions
Exam 14: More About Classes46 Questions
Exam 15: Inheritance, Polymorphism, and Virtual Functions43 Questions
Exam 16: Exceptions and Templates36 Questions
Exam 17: The Standard Template Library38 Questions
Exam 18: Linked Lists41 Questions
Exam 19: Stacks and Queues47 Questions
Exam 20: Recursion27 Questions
Exam 21: Binary Trees39 Questions
Select questions type
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:
False
The __________ algorithm uses recursion to sort a list.
Free
(Multiple Choice)
4.8/5
(38)
Correct Answer:
B
The QuickSort algorithm is used to sort
Free
(Multiple Choice)
4.8/5
(36)
Correct Answer:
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)
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 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)
return -1;
num = (first + last)/2;
if (array[num] == val)
return num;
if (array[num] < val)
return myRecursion(array, num + 1, last, val);
else
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)
{
If (n > 0)
{
Cout << "Good day!" << endl;
ShowMessage(n - 1);
}
}
(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)
{
If (n > 0)
{
cout << "Good day!" << endl;
showMessage(n + 1);
}
}
(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
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)