Deck 6: 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
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/36
Play
Full screen (f)
Deck 6: Recursion
1
Recursion is a very powerful way to solve certain problems for which the solution would otherwise be very complicated.
True
2
The recursive algorithm must have three or more base cases.
False
3
A function that calls itself is an iterative function.
False
4
The base case starts the recursion in a recursive function.
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
5
Logically, you can think of a recursive function as having an unlimited number of copies of itself.
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
6
In recursion, the execution in the previous call begins from the point immediately following the recursive call.
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
7
After completing a particular recursive call, the program terminates.
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
8
Indirect recursion requires the same careful analysis as direct recursion.
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
9
Tracing through indirect recursion can be tedious.
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
10
The base case is never reached or does not exist in an infinite recursion.
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
11
The limiting condition for a list might be the number of elements in the list.
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
12
Certain applications might require the data in an ordered list to be printed in descending order, which means that we must print the list backward.
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
13
We can traverse a singly linked list backward starting from the last node.
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
14
The execution of the recursive version of the program to calculate a Fibonacci number is as efficient as the execution of the nonrecursive version.
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
15
The rightmost bit of 33 is 2.
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
16
The process of solving a problem by reducing it to smaller versions of itself is called ____.
A) iteration
B) succession
C) recursion
D) repulsion
A) iteration
B) succession
C) recursion
D) repulsion
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
17
An algorithm that finds the solution to a given problem by reducing the problem to smaller versions of itself is called a(n) ____.
A) iterative algorithm
B) recursive algorithm
C) regressive algorithm
D) successive algorithm
A) iterative algorithm
B) recursive algorithm
C) regressive algorithm
D) successive algorithm
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
18
A function is called ____ recursive if it calls itself.
A) indirectly
B) implicitly
C) apparently
D) directly
A) indirectly
B) implicitly
C) apparently
D) directly
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
19
A function that calls another function and eventually results in the original function call is said to be ____ recursive.
A) directly
B) indeterminantly
C) indirectly
D) suspiciously
A) directly
B) indeterminantly
C) indirectly
D) suspiciously
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
20
Every call to a recursive function has its own code and its own set of ____ and local variables.
A) headers
B) parameters
C) stack
D) heap
A) headers
B) parameters
C) stack
D) heap
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
21
The nodes of an ordered linked list are in ____ order.
A) descending
B) optimized
C) unknown
D) ascending
A) descending
B) optimized
C) unknown
D) ascending
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
22
Given a pointer to a list, the function ____ prints the elements of the list in reverse order.
A) reverse
B) reversePrint
C) invert
D) translate
A) reverse
B) reversePrint
C) invert
D) translate
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
23
A sequence of number such as 1, 1, 2, 3, 5, 8, 13, 21, 34, ... is called a ____ sequence.
A) Newtonian
B) Gaussian
C) Fibonacci
D) Marconi
A) Newtonian
B) Gaussian
C) Fibonacci
D) Marconi
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
24
In the Tower of Hanoi problem, it would take about ____ years for the computer to generate 264 moves at the rate of 1 billion moves per second.
A) 5
B) 50
C) 500
D) 5,000
A) 5
B) 50
C) 500
D) 5,000
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
25
We call the remainder of x after division by 2 the ____ bit of x.
A) rightmost
B) leftmost
C) middlemost
D) innermost
A) rightmost
B) leftmost
C) middlemost
D) innermost
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
26
____ use a looping structure, such as while, for, or do. . .while, to repeat a set of statements.
A) Recursive control structures
B) Iterative control structures
C) Sequential control structures
D) Decisions structures
A) Recursive control structures
B) Iterative control structures
C) Sequential control structures
D) Decisions structures
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
27
In addition to the nature of the solution, ____ is the other key factor in determining whether recursion or iteration is the better approach.
A) latitude
B) elegance
C) efficacy
D) efficiency
A) latitude
B) elegance
C) efficacy
D) efficiency
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
28
When a function is called, ____ is allocated for its formal parameters and local variables.
A) nothing
B) memory space
C) global space
D) heap space
A) nothing
B) memory space
C) global space
D) heap space
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
29
When the function terminates, its memory space is ____.
A) allocated
B) recycled
C) left intact
D) deallocated
A) allocated
B) recycled
C) left intact
D) deallocated
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
30
Every recursive call requires the system to allocate memory space for its ____ and local variables.
A) formal parameters
B) informal parameters
C) global values
D) register values
A) formal parameters
B) informal parameters
C) global values
D) register values
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
31
Even though we don't need to write program statements to allocate and deallocate memory, ____ is associated with executing a recursive function, both in terms of memory space and execution time.
A) overburden
B) compiler interpretation
C) overhead
D) code interpretation
A) overburden
B) compiler interpretation
C) overhead
D) code interpretation
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
32
A recursive function executes ____ its iterative counterpart.
A) more slowly than
B) more quickly than
C) at the same speed as
D) proportionately to
A) more slowly than
B) more quickly than
C) at the same speed as
D) proportionately to
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
33
A recursive function is ____ a corresponding iterative function in terms of execution time and memory usage.
A) more efficient than
B) proportional to
C) similar to
D) less efficient than
A) more efficient than
B) proportional to
C) similar to
D) less efficient than
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
34
The ____ attempts to find solutions to a problem by constructing partial solutions and making sure that any partial solution does not violate the problem requirements.
A) backtracking algorithm
B) inferring algorithm
C) interpretation algorithm
D) stack tracing algorithm
A) backtracking algorithm
B) inferring algorithm
C) interpretation algorithm
D) stack tracing algorithm
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
35
The ____ algorithm tries to extend a partial solution toward completion.
A) backordering
B) tracing
C) backtracking
D) recursive
A) backordering
B) tracing
C) backtracking
D) recursive
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck
36
The solutions generated by the backtracking algorithm can be best represented by a(n) ____.
A) list
B) record
C) tree
D) array
A) list
B) record
C) tree
D) array
Unlock Deck
Unlock for access to all 36 flashcards in this deck.
Unlock Deck
k this deck