Which of these is a base case for a recursive computation of \"n\" factorial? Se
ID: 3768219 • Letter: W
Question
Which of these is a base case for a recursive computation of "n" factorial?
Select one:
a. n! = n(n - 1)!
b. n! = 1
c. 2! = 2
d. n = n - 1
e. 0! = 1
Which of these might be used to solve a problem?
Select one:
a. any of these might be used
b. iteration
c. recursion
d. a formula
e. selection
For the Towers of Hanoi problem, which of these is NOT allowed?
Select one:
a. moving a single disk at a time
b. placing a larger disk on top of a smaller disk
c. placing a smaller disk on top of a larger disk
d. using the middle tower
e. moving a disk more than once
For a recursive palidrome checker, which of these is a base case?
Select one:
a. If the first and last characters are not the same, the text is not a palidrome.
b. If the first and last characters are not the same, the text is a palidrome.
c. If the first and last characters are the same, the text is a palidrome.
d. If the first and last characters are the same, the text is not a palidrome.
e. If there is an odd number of characters, the text is not a palidrome.
Compared to iteration, which of these is a benefit of recursion?
Select one:
a. faster execution
b. compact elegant solution
c. more memory usage
d. harder to understand
e. obvious how to write recursive code
Which of these is NOT a possible number of base cases for a recursive computation?
Select one:
a. 0
b. 1
c. 2
d. 3
e. 4
For a recursive binary search, which of these is a general case?
Select one:
a. If middle item != key, return not found indicator.
b. If middle item == key, return its index.
c. If middle item > key, search lower subarray.
d. If middle item > key, search upper subarray.
e. If middle item > key, stop.
Which of these is an invariant relationship that expresses a case in terms of simpler, intermediate subcases of itself?
Select one:
a. composition
b. iteration
c. general case
d. base case
e. inheritance
Which of these is an invariant relationship that expresses a case in terms of simpler, intermediate subcases of itself?
Select one:
a. composition
b. iteration
c. general case
d. base case
e. inheritance
A recursive method calls itself repeatedly until which of these occurs?
Select one:
a. a call returns void
b. the loop condition returns false
c. the call stack overflows
d. a base case is reached
e. the general case is reached
For recursion, which of these has an obvious known solution?
Select one:
a. general case
b. switch case
c. default case
d. iteration case
e. base case
Which of these maintains the local variable values and next instruction address of method calls?
Select one:
a. program queue
b. next instruction pointer
c. method table
d. call stack
e. return value
Which of these has the same return value from each recursive call?
Select one:
a. tail recursion
b. head recursion
c. invariant recursion
d. symmetrical recursion
e. constant recursion
Which of these calls itself?
Select one:
a. iterative code
b. selection code
c. constructor
d. method that returns void
e. recursive method
Explanation / Answer
Which of these is a base case for a recursive computation of "n" factorial?
Select one:
a. n! = n(n - 1)!
Which of these might be used to solve a problem?
Select one:
a. any of these might be used
For the Towers of Hanoi problem, which of these is NOT allowed?
Select one:
b. placing a larger disk on top of a smaller disk
For a recursive palidrome checker, which of these is a base case?
Select one:
a. If the first and last characters are not the same, the text is not a palidrome.
Compared to iteration, which of these is a benefit of recursion?
Select one:
b. compact elegant solution
Which of these is NOT a possible number of base cases for a recursive computation?
Select one:
a. 0
For a recursive binary search, which of these is a general case?
Select one:
b. If middle item == key, return its index.
Which of these is an invariant relationship that expresses a case in terms of simpler, intermediate subcases of itself?
Select one:
b. iteration
Which of these is an invariant relationship that expresses a case in terms of simpler, intermediate subcases of itself?
Select one:
b. iteration
A recursive method calls itself repeatedly until which of these occurs?
Select one:
d. a base case is reached
For recursion, which of these has an obvious known solution?
Select one:
e. base case
Which of these maintains the local variable values and next instruction address of method calls?
Select one:
d. call stack
Which of these has the same return value from each recursive call?
Select one:
c. invariant recursion
Which of these calls itself?
Select one:
e. recursive method
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.