Assign9

Ace your homework & exams now with Quizwiz!

7

A method is called from the main method for the first time. It then calls itself seven times. What is the depth of recursion?

True

A problem can be solved recursively if it can be broken down into successive smaller problems that are identical to the overall problem.(T/F)

False

A recursive method can have no more than one base case.(T/F)

True

The Towers of Hanoi is a mathematical game that is often used in computer science textbooks to illustrate the power of recursion.(T/F)

base case

The ________ is at least one case in which a problem can be solved without recursion.

True

The recursive binary search algorithm is a good example of repeatedly breaking a problem down into smaller pieces until it is solved.(T/F)

direct recursion

When recursive methods directly call themselves, it is known as this.

False

Whereas a recursive algorithm might result in faster execution time, the programmer might be able to design an iterative algorithm faster.(T/F)

False

Without a base case, a recursive method will call itself only once and stop.(T/F)

indirect recursion

This occurs when method A calls method B, which in turn calls method A.

recursive case

In the ________, we must always reduce the problem to a smaller version of the original problem.

True

Recursion can be a powerful tool for solving repetitive problems and is an important topic in upper-level computer science courses.(T/F)

False

The recursive case does not require recursion, so it stops the chain of recursive calls.(T/F)

the depth of recursion

Like a loop, a recursive method must have which of the following?

All of these

Which of the following problems can be solved recursively?

True

Any problem that can be solved recursively can also be solved iteratively, with a loop.(T/F)

recursive

A method that calls itself is a ________ method.

Like a loop, a recursive method must have which of the following?

Like a loop, a recursive method must have which of the following?

True

Recursion is never absolutely required to solve a problem.(T/F)

overhead

The actions performed by the JVM that take place with each method call are sometimes referred to as this.


Related study sets

BECN Money, Banking, Finance (Ch.10.2 & 10.4) Ch. 13 5th Ed.

View Set

Anatomy & Physiology Test from AMA

View Set