Deck 15: Recursion
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/20
Play
Full screen (f)
Deck 15: Recursion
1
The Towers of Hanoi is a mathematical game that is often used in computer science textbooks to illustrate the power of recursion.
True
2
This occurs when method A calls method B, which in turn calls method A.
A) dynamic recursion
B) linear recursion
C) direct recursion
D) indirect recursion
A) dynamic recursion
B) linear recursion
C) direct recursion
D) indirect recursion
D
3
Recursion is never absolutely required to solve a problem.
True
4
A problem can be solved recursively if it can be broken down into successive smaller problems that are identical to the overall problem.
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
5
Without a base case, a recursive method will call itself only once and stop.
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
6
When recursive methods directly call themselves, it is known as this.
A) direct recursion
B) indirect recursion
C) basic recursion
D) static recursion
A) direct recursion
B) indirect recursion
C) basic recursion
D) static recursion
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
7
The number of times that a method calls itself is known as
A) the call count.
B) the cyclic identity.
C) the method heap.
D) the depth of recursion.
A) the call count.
B) the cyclic identity.
C) the method heap.
D) the depth of recursion.
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
8
The actions performed by the JVM that take place with each method call are sometimes referred to as this.
A) overhead
B) allocation
C) overflow
D) retention
A) overhead
B) allocation
C) overflow
D) retention
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
9
A recursive method can have no more than one base case.
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
10
Any problem that can be solved recursively can also be solved iteratively, with a loop.
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
11
The recursive case does not require recursion, so it stops the chain of recursive calls.
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
12
A method that calls itself is a ________ method.
A) recursive
B) redundant
C) binary
D) derived
A) recursive
B) redundant
C) binary
D) derived
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
13
The recursive binary search algorithm is a good example of repeatedly breaking a problem down into smaller pieces until it is solved.
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
14
In the ________, we must always reduce the problem to a smaller version of the original problem.
A) base case
B) partition case
C) lessening case
D) recursive case
A) base case
B) partition case
C) lessening case
D) recursive case
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
15
Which of the following problems can be solved recursively?
A) greatest common denominator
B) towers of Hanoi
C) binary search
D) All of the Above
A) greatest common denominator
B) towers of Hanoi
C) binary search
D) All of the Above
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
16
Like a loop, a recursive method must have which of the following?
A) a statement that increments the control variable
B) a control variable initialized to a starting value
C) some way to control the number of times it repeats
D) All of the above
A) a statement that increments the control variable
B) a control variable initialized to a starting value
C) some way to control the number of times it repeats
D) All of the above
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
17
The ________ is at least one case in which a problem can be solved without recursion.
A) recursive case
B) base case
C) termination point
D) point of absolution
A) recursive case
B) base case
C) termination point
D) point of absolution
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
18
Recursion can be a powerful tool for solving repetitive problems and is an important topic in upper-level computer science courses.
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
19
Whereas a recursive algorithm might result in faster execution time, the programmer might be able to design an iterative algorithm faster.
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck
20
A method is called from the main method for the first time. It then calls itself seven times. What is the depth of recursion?
A) 1
B) 7
C) 8
D) 6
A) 1
B) 7
C) 8
D) 6
Unlock Deck
Unlock for access to all 20 flashcards in this deck.
Unlock Deck
k this deck