Exam 14: Recursion
Exam 1: Introduction to Computers and Java40 Questions
Exam 2: Java Fundamentals40 Questions
Exam 3: A First Look at Classes and Objects40 Questions
Exam 4: Decision Structures42 Questions
Exam 5: Loops and Files40 Questions
Exam 6: A Second Look at Classes and Objects40 Questions
Exam 7: Arrays and the Arraylist Class40 Questions
Exam 8: Text Processing and Wrapper Classes40 Questions
Exam 9: Inheritance40 Questions
Exam 10: Exceptions and Advanced File Io40 Questions
Exam 11: Java-Fx: Gui Programming and Basic Controls40 Questions
Exam 12: Java-Fx: Advanced Controls40 Questions
Exam 13: Java-Fx: Graphics, Effects, and Media40 Questions
Exam 14: Recursion24 Questions
Exam 15: Databases40 Questions
Select questions type
A recursive method can have only one base case.
Free
(True/False)
4.8/5
(86)
Correct Answer:
False
To use recursion for a binary search, what is required before the search can proceed?
Free
(Multiple Choice)
4.8/5
(89)
Correct Answer:
C
A problem can be solved recursively if it can be broken down into successive smaller problems that are identical to the overall problem.
Free
(True/False)
4.9/5
(83)
Correct Answer:
True
__________ occurs when method A calls method B which in turn calls method A
(Multiple Choice)
4.9/5
(81)
The __________ is at least one case in which a problem can be solved without recursion.
(Multiple Choice)
5.0/5
(79)
In a recursive program, the number of times a method calls itself is known as
(Multiple Choice)
4.8/5
(77)
Like a loop, a recursive method must have which of the following?
(Multiple Choice)
4.9/5
(79)
The Towers of Hanoi is a mathematical game that is often used in computer science textbooks to illustrate the power of recursion.
(True/False)
4.9/5
(75)
A method is called from the main method for the first time. It then calls itself seven times. What is the depth of recursion?
(Multiple Choice)
4.9/5
(66)
When recursive methods directly call themselves, it is known as
(Multiple Choice)
4.8/5
(77)
In the following code that uses recursion to find the factorial of a number, what is the base case?
private static int factorial(int n)
{
If (n == 0)
Return 1;
Else
Return n * factorial(n - 1);
}
(Multiple Choice)
4.8/5
(87)
Without a base case, a recursive method will call itself only once and stop.
(True/False)
4.8/5
(86)
Recursion can be a powerful tool for solving repetitive problems and is an important topic in upper-level computer science courses.
(True/False)
5.0/5
(84)
In the __________, we must always reduce the problem to a smaller version of the original problem.
(Multiple Choice)
4.8/5
(79)
The recursive case does not require recursion so it stops the chain of recursive calls.
(True/False)
4.7/5
(80)
In the following code that uses recursion to find the greatest common divisor of a number, what is the base case?
public static int gcd(int x, int y)
{
If (x % y == 0)
Return y;
Else
Return gcd(y, x % y);
}
(Multiple Choice)
4.7/5
(79)
Any problem that can be solved recursively can also be solved iteratively, with a loop.
(True/False)
4.9/5
(95)
Showing 1 - 20 of 24
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)