Deck 9: Recursion
Question
Question
Question
Question
Question
Question
Question
Question
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/28
Play
Full screen (f)
Deck 9: Recursion
1
Like a loop, a recursive method must have a way to control the number of times it ___________________.
repeats
2
The number of times a method calls itself is known as the:
A) depth of recursion
B) depth of repetition
C) length of recursion
D) number of repetitions
E) None of these
A) depth of recursion
B) depth of repetition
C) length of recursion
D) number of repetitions
E) None of these
A
3
Recursion can be a powerful tool for solving repetitive problems.
True
4
What is the term for the aspect of a problem that is reduced to a smaller version of the original problem?
A) base case
B) ending case
C) final case
D) recursive case
E) None of these
A) base case
B) ending case
C) final case
D) recursive case
E) None of these
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
5
Any problem that can be solved with recursion can also be solved with a loop.
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
6
A problem can be solved with recursion if
A) it can be broken down into any set of smaller problems
B) it can be broken down into at least three different subparts
C) it can be broken down into successive smaller problems that are identical to the overall problem
D) it can be solved by any method
E) None of these
A) it can be broken down into any set of smaller problems
B) it can be broken down into at least three different subparts
C) it can be broken down into successive smaller problems that are identical to the overall problem
D) it can be solved by any method
E) None of these
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
7
The base case is the aspect of a problem that can be solved without recursion.
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
8
A recursive method is a method that calls itself.
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
9
A(n) ___________________ method is a method that calls itself.
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
10
Any mathematical problem can be solved with recursion.
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
11
The number of times a method calls itself is known as the depth of iteration.
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
12
Like a loop, a recursive method must have some way to control the number of times it repeats.
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
13
Which of the following would be a base case for a summation algorithm (the sum of the numbers from 0 to n)?
A) If n = 0 then summation(n) = 0
B) if n > 0 then summation(n) = 5
C) If n > 0 then summation(n) = getValue(n)
D) If n > 0 then summation(n) = n + summation(n-1)
E) None of these
A) If n = 0 then summation(n) = 0
B) if n > 0 then summation(n) = 5
C) If n > 0 then summation(n) = getValue(n)
D) If n > 0 then summation(n) = n + summation(n-1)
E) None of these
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
14
What is the term for the aspect of a recursive problem that can be solved without recursion?
A) base case
B) ending case
C) final case
D) recursive case
E) None of these
A) base case
B) ending case
C) final case
D) recursive case
E) None of these
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
15
The recursive case of a problem is solved without recursion.
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
16
When a recursive method ends, control of the program returns to the point:
A) after the recursive method call
B) before the recursive method call
C) before the next method
D) after the next method
E) None of these
A) after the recursive method call
B) before the recursive method call
C) before the next method
D) after the next method
E) None of these
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
17
The following is an example of a base case for a summation algorithm (the sum of the numbers from 0 to n): If n > 0 then summation (n) = n + summation (n-1)
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
18
The depth of recursion for a method that calls itself five times is six.
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
19
Which of the following would be a recursive case for a summation algorithm (the sum of the numbers from 0 to n)?
A) If n = 0 then summation(n) = 0
B) if n > 0 then summation(n) = 5
C) If n > 0 then summation(n) = getValue(n)
D) If n > 0 then summation(n) = n + summation(n-1)
E) None of these
A) If n = 0 then summation(n) = 0
B) if n > 0 then summation(n) = 5
C) If n > 0 then summation(n) = getValue(n)
D) If n > 0 then summation(n) = n + summation(n-1)
E) None of these
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
20
A method that calls itself is referred to as a(n):
A) depth method
B) iterative method
C) recursive method
D) repetitive method
E) None of these
A) depth method
B) iterative method
C) recursive method
D) repetitive method
E) None of these
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
21
The following is an example of a(n) ___________________ case for a summation algorithm (the sum of the numbers from 0 to n): If n = 0 then summation(n) = 0
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
22
Usually, a problem is reduced by making the value of a(n) ___________________ smaller with each recursive call.
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
23
The following is an example of a(n) ___________________ case for a summation algorithm (the sum of the numbers from 0 to n): If n > 0 then summation(n) = n + summation(n-1)
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
24
The number of times that a method calls itself is known as the ___________________ of recursion.
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
25
The ___________________ case the problem is solved without recursion.
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
26
In the ___________________ case the problem is reduced to a smaller version of the original problem.
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
27
Any problem that can be solved with recursion can also be solved with a(n)___________________.
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck
28
A problem can be solved with ___________________ if it can be broken down into successive smaller problems that are identical to the overall problem.
Unlock Deck
Unlock for access to all 28 flashcards in this deck.
Unlock Deck
k this deck