Exam 14: Recursion

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

A recursive method can have only one base case.

Free
(True/False)
4.8/5
(86)
Correct Answer:
Verified

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:
Verified

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:
Verified

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)

Recursion is never absolutely required to solve a problem.

(True/False)
4.8/5
(70)

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)

Which of the following problems can be solved recursively?

(Multiple Choice)
4.7/5
(74)

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)

A method that calls itself is a __________ method.

(Multiple Choice)
4.9/5
(96)

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
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)