Question: Which one can be used to solve a problem? Iteration A formula Selection Which one is a base case for a recursive computation of n
Which one can be used to solve a problem?
Iteration
A formula
Selection
Which one is a base case for a recursive computation of n factorial?
n!=n/n-1)!
2!=2
0!=1
For a recursive palidrome checker, which one is a base case?
If the first and last characters are not the same, the text is not a palindrome.
If the first and last characters are not the same, the text is a palidrome.
If the first and last characters are the same, the text is not a palindrome.
If there is an odd number of a character, the text is not a palindrome.
Which one is a characteristic of recursion?
Repetively calling an identical version of the same problem.
Repetively calling a simpler version of the same problem
Repetively calling a more complex version of the same problem.
Repetively calling a more complex version of a different problem.
Compared to iteration, which one is a benefit of recursion?
Compact elegant solution
More memory usage
Harder understand
Obvious how to write recursive code.
Which one is an invariant relationship that expresses a case in terms of simpler intermediate subcases of itself?
Composition
General case
Base case
Inheritance
Which one is the general case for a recursive computation of n factorial?
A. n!=(n-1)!
B. n!=n(n-1)!
c. n!=1
d. n!=n(n-1)(n-2)(2)!
A recursive method calls itself repeatedly until which one occurs?
A call returns void
The call stack overflows
A bade case is reached
The general case is reached
For a recursion, which one has an obvious known solution?
A switch case
B default case
C iteration case
D base case
Which of these maintains the local variable values and next instruction address of method calls?
Program queue
Next instruction pointer
Call stack
Return value
Which one has the same return value from each recursive call?
A tail recursion
B head recursion
C invariant recursion
D constant recursion
Which of these calls itself?
Iterative code
Selection code
Method that returns void
Recursive method
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
