Deck 18: Recursion
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/14
Play
Full screen (f)
Deck 18: Recursion
1
The current method executing is always the method whose activation record is:
A)at the bottom of the stack.
B)at the top of the stack.
C)never placed on the stack.
D)second from the top of the stack,just below the previous method call.
A)at the bottom of the stack.
B)at the top of the stack.
C)never placed on the stack.
D)second from the top of the stack,just below the previous method call.
B
2
Recursion often is preferable to iteration because
A)it is faster.
B)it requires less memory.
C)it models the problem more logically.
D)All of the above.
A)it is faster.
B)it requires less memory.
C)it models the problem more logically.
D)All of the above.
C
3
In recursive backtracking,if one set of recursive calls does not result in a solution to the problem,what happens?
A)The program returns to a previous decision point and makes a different decision.
B)The program backs up to the previous decision point and throws an exception.
C)The program continues,with unexpected results.
D)The program backs up to the original method call.
A)The program returns to a previous decision point and makes a different decision.
B)The program backs up to the previous decision point and throws an exception.
C)The program continues,with unexpected results.
D)The program backs up to the original method call.
A
4
The operands of an operator are evaluated:
A)from right to left.
B)from left to right.
C)at the same time.
D)in an order that is specific to each operator.
A)from right to left.
B)from left to right.
C)at the same time.
D)in an order that is specific to each operator.
Unlock Deck
Unlock for access to all 14 flashcards in this deck.
Unlock Deck
k this deck
5
The recursion step should:
A)check for the base case.
B)call a fresh copy of the recursive method to work on a smaller problem.
C)make two calls to the recursive method.
D)iterate until it reaches a termination condition.
A)check for the base case.
B)call a fresh copy of the recursive method to work on a smaller problem.
C)make two calls to the recursive method.
D)iterate until it reaches a termination condition.
Unlock Deck
Unlock for access to all 14 flashcards in this deck.
Unlock Deck
k this deck
6
After a fractal's pattern is applied several times,the shape of the fractal will generally become:
A)disjointed and less detailed.
B)stabilized and more detailed.
C)identical to the original fractal.
D)None of the above.
A)disjointed and less detailed.
B)stabilized and more detailed.
C)identical to the original fractal.
D)None of the above.
Unlock Deck
Unlock for access to all 14 flashcards in this deck.
Unlock Deck
k this deck
7
Recursion is often less efficient than iteration because:
A)it can cause an explosion of method calls.
B)it is not as intuitive.
C)recursive methods are harder to debug.
D)recursive methods take longer to program.
A)it can cause an explosion of method calls.
B)it is not as intuitive.
C)recursive methods are harder to debug.
D)recursive methods take longer to program.
Unlock Deck
Unlock for access to all 14 flashcards in this deck.
Unlock Deck
k this deck
8
When the recursion step executes:
A)this is known as indirect recursion.
B)all of the computer's processes halt until the recursion step has completed executing.
C)the original call to the method is still active.
D)All of the above.
A)this is known as indirect recursion.
B)all of the computer's processes halt until the recursion step has completed executing.
C)the original call to the method is still active.
D)All of the above.
Unlock Deck
Unlock for access to all 14 flashcards in this deck.
Unlock Deck
k this deck
9
All of the following are true for both recursion and iteration except:
A)they have a base case.
B)they can cause infinite loops or infinite recursion.
C)they are based on a control statement.
D)both gradually approach termination.
A)they have a base case.
B)they can cause infinite loops or infinite recursion.
C)they are based on a control statement.
D)both gradually approach termination.
Unlock Deck
Unlock for access to all 14 flashcards in this deck.
Unlock Deck
k this deck
10
When a recursive method is called to solve a problem,the method actually is capable of solving only the simplest case(s),or .
A)base case(s).
B)base step(s).
C)recursive call(s).
D)recursion step(s).
A)base case(s).
B)base step(s).
C)recursive call(s).
D)recursion step(s).
Unlock Deck
Unlock for access to all 14 flashcards in this deck.
Unlock Deck
k this deck
11
Each time a fractal's pattern is applied to it,the fractal is said to be at a new:
A)level.
B)depth.
C)order.
D)All of the above.
A)level.
B)depth.
C)order.
D)All of the above.
Unlock Deck
Unlock for access to all 14 flashcards in this deck.
Unlock Deck
k this deck
12
Fractals that yield an exact copy of the original when a portion of the original image is magnified are called .
A)strictly self similar fractals.
B)Koch Curve fractals.
C)similar fractals.
D)mirror fractals.
A)strictly self similar fractals.
B)Koch Curve fractals.
C)similar fractals.
D)mirror fractals.
Unlock Deck
Unlock for access to all 14 flashcards in this deck.
Unlock Deck
k this deck
13
A recursive method .
A)is a method that calls itself.
B)can be called directly.
C)can be called indirectly through another method.
D)All of the above.
A)is a method that calls itself.
B)can be called directly.
C)can be called indirectly through another method.
D)All of the above.
Unlock Deck
Unlock for access to all 14 flashcards in this deck.
Unlock Deck
k this deck
14
The number of calls to recursively calculate the Fibonacci value of 7 is:
A)7
B)13
C)41
D)39
A)7
B)13
C)41
D)39
Unlock Deck
Unlock for access to all 14 flashcards in this deck.
Unlock Deck
k this deck