Programming II Test 2
True
A problem can be solved recursively if it can be broken down into successive smaller problems that are identical to the overall problem. Question options: True False
F
A problem can be solved recursively if it can be broken down into successive smaller problems that are unique within the overall problem. T or F
False
A recursive method can have no more than one base case. Question options: True False
All of the Above
Which of the following problems can be solved recursively? Question options: binary search towers of Hanoi greatest common denominator All of the Above
T
An instance of a class does not have to exist in order for values to be stored in a class's static fields. T or F
True
Any problem that can be solved recursively can also be solved iteratively, with a loop. Question options: True False
recursive case
In the ________, we must always reduce the problem to a smaller version of the original problem. Question options: base case recursive case partition case lessening case
some way to control the number of times it repeats
Like a loop, a recursive method must have which of the following? Question options: some way to control the number of times it repeats a control variable initialized to a starting value a statement that increments the control variable All of the above
True
Recursion is never absolutely required to solve a problem. Question options: True False
overhead
The actions performed by the JVM that take place with each method call are sometimes referred to as this. Question options: allocation retention overhead overflow
C
The following catch statement can: catch (Exception e) {...} a. can handle all exceptions that are instances of the Exception class, but not a subclass of Exception. b. handle all throwable objects by using polymorphic reference as a parameter in the catch clause. c. handle all exceptions that are instances of the Exception class or a subclass of Exception. d. is an error since no objects are instantiated in the Exception class.
False
The recursive case does not require recursion, so it stops the chain of recursive calls. Question options: True False
indirect recursion
This occurs when method A calls method B, which in turn calls method A. Question options: indirect recursion direct recursion dynamic recursion linear recursion