Deck 13: Recursion

Full screen (f)
exit full mode
Question
What is the first step that needs to be taken in order to apply a recursive approach?

A) Identify at least one case in which the problem can be solved without recursion.
B) Determine a way to solve the problem in all other circumstances using recursion.
C) Identify a way to stop the recursion.
D) Determine a way to return to the main function.
Use Space or
up arrow
down arrow
to flip the card.
Question
The process of calling a function requires _____.

A) a long memory access
B) a quick memory access
C) several actions to be performed by the computer
D) one action to be performed by the computer
Question
A problem can be solved with recursion if it can be broken down into _____ problems.

A) smaller
B) one-line
C) manageable
D) modular
Question
In many cases a solution using recursion is more evident than a solution using a loop.
Question
If the problem can be solved immediately without recursion, then the recursive function _____.

A) solves it and returns
B) Exits
C) returns the result
D) generates a run-time error
Question
If the problem cannot be solved now, then a recursive function reduces it to a smaller but similar problem and _____.

A) exits
B) returns to the main function
C) returns to the calling function
D) calls itself to solve the smaller problem
Question
Recursive functions are _____ iterative algorithms.

A) more efficient than
B) less efficient than
C) as efficient as
D) incomparable to
Question
What is referred to as the base case?

A) At least one case in which the problem can be solved without recursion
B) The circumstances to solve the problem using recursion
C) The way to stop the recursion
D) The way to return to the main function
Question
A recursive function includes _____ which are not necessary in a loop structure.

A) function calls
B) conditional clauses
C) overhead actions
D) object instances
Question
The base case is a case in which the problem can be solved without _____.

A) loops
B) if
C) objects
D) recursion
Question
There can be several functions involved in the recursion.
Question
What defines the depth of recursion?

A) The length of the algorithm
B) The numbers of function calls
C) The number of times the function calls itself
D) The number of times it goes back to the main function
Question
What is the second step that needs to be taken in order to apply a recursive approach?

A) Identify at least one case in which the problem can be solved without recursion.
B) Determine a way to use recursion in order to solve the problem in all circumstances which cannot be solved without recursion.
C) Identify a way to stop the recursion.
D) Determine a way to return to the main function.
Question
function A calls function B, which calls function C, which calls function A. This is called _____ recursion.

A) continuous
B) direct
C) three function call
D) indirect
Question
A recursive function must have some way to control the number of times it repeats.
Question
If a recursive solution is evident for a particular problem, and the recursive algorithm does not slow system performance by an intolerable amount, then recursion would be a good design choice.
Question
Recursion is _____.

A) never required to solve a problem
B) required to solve mathematical problems
C) never required to solve string problems
D) required to solve some problems
Question
What is referred to as the recursive case?

A) At least one case in which the problem can be solved without recursion
B) A way to solve the problem in all other circumstances using recursion
C) The way to stop the recursion
D) The way to return to the main function
Question
A function is called from the main function for the first time. It then calls itself seven times. What is the depth of recursion?

A) Eight
B) Two
C) One
D) Seven
Question
A base case is not necessary for all recursive algorithms.
Question
Recursive algorithms are more concise and efficient than iterative algorithms.
Question
The majority of repetitive programming tasks are best done with _______________.
Question
A function is called from the main function and then it calls itself five times. The depth of recursion is _______________.
Question
A recursion in which a function directly calls itself is known as _______________ recursion.
Question
A solution using a(n) _______________ is usually more evident than a recursive solution.
Question
Each time a function is called, the system incurs overhead that is not necessary with a loop.
Question
Recursive function calls are _______________ efficient than loops.
Question
When function A calls function B, which in turn calls function A, it is known as indirect recursion.
Question
The base case does not require _______________, so it stops the chain of recursive calls.
Question
All the cases of the recursive solution other than the base case are called the _______________ case.
Question
Some problems are _______________ solved with recursion than with a loop.
Question
Recursion is required to solve some type of problems.
Question
Each time a function is called, the system incurs _______________ that is not necessary with a loop.
Question
Usually, a problem is reduced by making the value of one or more parameters _______________ with each recursive call.
Question
A problem can be solved with recursion if it can be broken into smaller problems that are identical in structure to the overall problem.
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/35
auto play flashcards
Play
simple tutorial
Full screen (f)
exit full mode
Deck 13: Recursion
1
What is the first step that needs to be taken in order to apply a recursive approach?

A) Identify at least one case in which the problem can be solved without recursion.
B) Determine a way to solve the problem in all other circumstances using recursion.
C) Identify a way to stop the recursion.
D) Determine a way to return to the main function.
A
2
The process of calling a function requires _____.

A) a long memory access
B) a quick memory access
C) several actions to be performed by the computer
D) one action to be performed by the computer
C
3
A problem can be solved with recursion if it can be broken down into _____ problems.

A) smaller
B) one-line
C) manageable
D) modular
A
4
In many cases a solution using recursion is more evident than a solution using a loop.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
5
If the problem can be solved immediately without recursion, then the recursive function _____.

A) solves it and returns
B) Exits
C) returns the result
D) generates a run-time error
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
6
If the problem cannot be solved now, then a recursive function reduces it to a smaller but similar problem and _____.

A) exits
B) returns to the main function
C) returns to the calling function
D) calls itself to solve the smaller problem
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
7
Recursive functions are _____ iterative algorithms.

A) more efficient than
B) less efficient than
C) as efficient as
D) incomparable to
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
8
What is referred to as the base case?

A) At least one case in which the problem can be solved without recursion
B) The circumstances to solve the problem using recursion
C) The way to stop the recursion
D) The way to return to the main function
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
9
A recursive function includes _____ which are not necessary in a loop structure.

A) function calls
B) conditional clauses
C) overhead actions
D) object instances
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
10
The base case is a case in which the problem can be solved without _____.

A) loops
B) if
C) objects
D) recursion
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
11
There can be several functions involved in the recursion.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
12
What defines the depth of recursion?

A) The length of the algorithm
B) The numbers of function calls
C) The number of times the function calls itself
D) The number of times it goes back to the main function
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
13
What is the second step that needs to be taken in order to apply a recursive approach?

A) Identify at least one case in which the problem can be solved without recursion.
B) Determine a way to use recursion in order to solve the problem in all circumstances which cannot be solved without recursion.
C) Identify a way to stop the recursion.
D) Determine a way to return to the main function.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
14
function A calls function B, which calls function C, which calls function A. This is called _____ recursion.

A) continuous
B) direct
C) three function call
D) indirect
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
15
A recursive function must have some way to control the number of times it repeats.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
16
If a recursive solution is evident for a particular problem, and the recursive algorithm does not slow system performance by an intolerable amount, then recursion would be a good design choice.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
17
Recursion is _____.

A) never required to solve a problem
B) required to solve mathematical problems
C) never required to solve string problems
D) required to solve some problems
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
18
What is referred to as the recursive case?

A) At least one case in which the problem can be solved without recursion
B) A way to solve the problem in all other circumstances using recursion
C) The way to stop the recursion
D) The way to return to the main function
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
19
A function is called from the main function for the first time. It then calls itself seven times. What is the depth of recursion?

A) Eight
B) Two
C) One
D) Seven
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
20
A base case is not necessary for all recursive algorithms.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
21
Recursive algorithms are more concise and efficient than iterative algorithms.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
22
The majority of repetitive programming tasks are best done with _______________.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
23
A function is called from the main function and then it calls itself five times. The depth of recursion is _______________.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
24
A recursion in which a function directly calls itself is known as _______________ recursion.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
25
A solution using a(n) _______________ is usually more evident than a recursive solution.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
26
Each time a function is called, the system incurs overhead that is not necessary with a loop.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
27
Recursive function calls are _______________ efficient than loops.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
28
When function A calls function B, which in turn calls function A, it is known as indirect recursion.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
29
The base case does not require _______________, so it stops the chain of recursive calls.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
30
All the cases of the recursive solution other than the base case are called the _______________ case.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
31
Some problems are _______________ solved with recursion than with a loop.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
32
Recursion is required to solve some type of problems.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
33
Each time a function is called, the system incurs _______________ that is not necessary with a loop.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
34
Usually, a problem is reduced by making the value of one or more parameters _______________ with each recursive call.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
35
A problem can be solved with recursion if it can be broken into smaller problems that are identical in structure to the overall problem.
Unlock Deck
Unlock for access to all 35 flashcards in this deck.
Unlock Deck
k this deck
locked card icon
Unlock Deck
Unlock for access to all 35 flashcards in this deck.