Recursion IT

¡Supera tus tareas y exámenes ahora con Quizwiz!

The area of memory where information about the active methods of a computer program are stored is referred to as the?

Call stack

In the context of recursion, "short-circuiting" means to:

Check for the base case before making a recursive call.

The fact that bad programs and/or bad data will result in bad results can be summarized as:

GIGO

The fact that bad programs/ or bad data result in bad results can be summarized as

GIGO

Did you mean recursion

Recursion Sorry Attempt At Humor

A Stack over will occur when

Recursion is excessively deep

When a method calls itself to solve a problem, the algorithm is referred to as?

Recursive

Depending on the programming language, what Java calls a "method" might be referred to as a function, procedure or subroutine.

True

In general, recursion should only be used when it simplifies the code without causing a significant loss of performance.

True

Problems that feature multi-way branching, where the method would recursively call itself in each branch are viable candidates for recursion.

True

Recursion is

used in some of the most efficient sorting algorithm's

Using a loop to solve a problem non-recursively is referred to as what type of solution

iterative

public class Quiz1 { public static void main(String[ ] args) { method1(10); } static void method1(int x) { if (x >= 1) { System.out.println(x); method2(x / 2); } } static void method2(int x) { if (x >= 1) { System.out.println(x); method1(x - 1); } } }

10 5 4 2 1

What is the value of 6!

720

A recursive algorithm without a base case is most like:

An infinite loop in an iterative program.

For which of the following conditions will using a recursive algorithm result in a call stack overflow?

Base case not specified. Input data set too large. Base case never satisfied.

The area of memory where information about the active methods of a computer is referred to as the

Call Stack

Which of the following will result in infinite recursion?

Failure to specify base case

Because recursive algorithms do not contain loops , they don't have characteristic time complexities like iterative programs do.

False

Because recursive algorithms do not contain loops, they don't have characteristic time complexities like iterative programs do.

False

For a given problem, a recursive solution will usually require less RAM than an iterative solution.

False

From A CPU and RAM perspective , using recursive algorithm's is always the most efficient way to solve a problem

False

From a CPU and RAM perspective, using a recursive algorithm is always the most efficient way to solve a problem.

False

Only extra-super-special-secret programming languages support recursion, most programming languages do not.

False

Which of the following are true regarding recursive tail-call optimization?

It could reduce the algorithm's call stack memory requirements from O(n) to O(1). It reduces the number of CPU cycles needed to execute the algorithm.

Which of the following programming techniques are supported by Java?

Iteration. In-line coding.

Which of the following programming techniques are supported by Java?

Iteration. In-line coding. Recursion without optimizations. Recursion incorporating base case short-circuiting.

One purpose of the call stack is to

Keep track of the point to which each method instance should return control when it finishes exucuting

if a program calculates n! using iteration, what would the time complexity be

Linear

Which of the following is an example of simple recursion?

Method "test2" calls method "test2".

if a particular recursive algorithm requires one cruise method call for each item in the input set, it has time complexity of.

O(n)

The technique of checking for the base case before making a recursive call is referred to as:

Short-circuiting

Based upon what you know about recursion, evaluate the following statement as either true or false: "When measuring the students' knowledge of recursion, it might be far too easy to make the quiz far too difficult."

True

A "wrapper method" is a method that:

Supports and calls another method.

It's called "recursion" because:

The method "recurs".

A triangular counts objects arranged

The specfied base case is incorrect

Any program that can be written recursively can also be written iteratively, and vice-versa.

True

Based on what you know about recursion, evaluate the following statement as ethier true or false When measuring the students' knowledge of recursion easy to make the quiz far too difficult

True


Conjuntos de estudio relacionados

chapter 2 commercial property insurance part 1 quiz

View Set

Chapter 30: Nursing Assessment: Hematologic System & Chapter 31: Nursing Management: Hematologic Problems (Comp. 11)

View Set

Marketing Chapter 13 Retailing and Wholesaling

View Set

BIO 1080, Chapter 5, The Microbial World

View Set

Chp. 3; sec. 3 . Debating the Constitution (blank)

View Set

Simulated Life and Health Insurance Exam

View Set

Nucleic Acid Conveys Genetic Information

View Set