Services
Discover
Homeschooling
Ask a Question
Log in
Sign up
Filters
Done
Question type:
Essay
Multiple Choice
Short Answer
True False
Matching
Topic
Computing
Study Set
Problem Solving with C++ Study Set 1
Quiz 14: Recursion
Path 4
Access For Free
Share
All types
Filters
Study Flashcards
Question 21
Multiple Choice
A definition that defines a concept or a formula in terms of the concept or formula is called
Question 22
Multiple Choice
What is wrong with the following recursive function? It should print out the array backwards. Void printint array[], int start, int size) { Ifstart == size) Return; Else { Printarray, start+1,size) ; Cout << array[start] << endl; } }
Question 23
Multiple Choice
In the following function, how many recursive calls are there? Void towerschar source, char dest, char help, int numDisks) { IfnumDisks<1) { Return; } Else { Towerssource,help,dest,numDisks-1) ; Cout << "Move disk from " << source << " to " <<dest<<endl; Towershelp,dest,source,numDisks-1) ; } }
Question 24
Multiple Choice
What is the output of the following code fragment? Int f1int n, int m) { Ifn < m) Return 0; Else ifn==m) Return m+ f1n-1,m) ; Else Return n+ f1n-2,m-1) ; } Int main) { Cout << f15,4) ; Return 0; }
Question 25
Multiple Choice
Every time a recursive function call is executed, a new __________ is put on the top of the stack.
Question 26
Multiple Choice
A stack exhibits _________ behavior.
Question 27
Multiple Choice
In order for the binary search to work correctly
Question 28
Multiple Choice
Implementing a task recursively rather than iteratively generally
Question 29
Multiple Choice
The factorial of an integer is the product of that integer multiplied by all the positive non-zero integers less than that integer. So, 5! ! is the mathematical symbol for factorial) is 5 * 4 * 3*2*1. 4! is 4*3*2*1, so 5! could be written as 5*4!. So a recursive definition of factorial is n! is n*n-1) !, as long as n >1. 1! is 1. What is the recursive call for this function fact) ?
Question 30
Multiple Choice
If you try to solve a problem recursively, you should
Question 31
Multiple Choice
The factorial of an integer is the product of that integer multiplied by all the positive non-zero integers less than that integer. So, 5! ! is the mathematical symbol for factorial) is 5 * 4 * 3*2*1. 4! is 4*3*2*1, so 5! could be written as 5*4!. So a recursive definition of factorial is n! is n*n-1) !, as long as n >1. 1! is 1. What is the stopping case for this function?
Question 32
Multiple Choice
What is wrong with the following recursive function? It should print out the array backwards. Void printint array[], int start, int size) { Ifstart == size) Return; Else { Printarray, start-1,size) ; Cout << array[start] << endl; } }