Ch 12

Ace your homework & exams now with Quizwiz!

A function is called from the main function for the first time. It then calls itself seven times. What is the depth of recursion? Eight Two One Seven

Seven

What defines the depth of recursion? The length of the algorithm The numbers of function calls The number of times the function calls itself The number of times it goes back to the main function

The number of times the function calls itself

Recursion is _____. never required to solve a problem required to solve mathematical problems never required to solve string problems required to solve some problems

never required to solve a problem

A recursive function includes _____ which are not necessary in a loop structure. function calls conditional clauses overhead actions object instances

overhead actions

The base case is a case in which the problem can be solved without _____. loops if objects recursion

recursion

The process of calling a function requires _____. a long memory access a quick memory access several actions to be performed by the computer one action to be performed by the computer

several actions to be performed by the computer

If the problem can be solved immediately without recursion, then the recursive function _____. solves it and returns Exits returns the result generates a run-time error

solves it and returns

What is referred to as the base case? At least one case in which the problem can be solved without recursion The circumstances to solve the problem using recursion The way to stop the recursion The way to return to the main function

At least one case in which the problem can be solved without recursion

What is the second step that needs to be taken in order to apply a recursive approach? Identify at least one case in which the problem can be solved without recursion. Determine a way to use recursion in order to solve the problem in all circumstances which cannot be solved without recursion. Identify a way to stop the recursion. Determine a way to return to the main function.

Determine a way to use recursion in order to solve the problem in all circumstances which cannot be solved without recursion.

If the problem cannot be solved now, then a recursive function reduces it to a smaller but similar problem and _____. exits returns to the main function returns to the calling function calls itself to solve the smaller problem

calls itself to solve the smaller problem


Related study sets

Chapter 11: Strategy Formulation and Implementation

View Set

Properties and Changes of matter unit test

View Set

Chapter 4 - Communicating for Success

View Set

Chapter 2: Scanning planes and Scanning Methods

View Set

Olds Maternal-Newborn Nursing Ch 34, 33, 26, 25, 23, 22, 21, 20

View Set

OCE1001 - Units 1, 2, 3, & 4 - Oceanography @ Broward College

View Set

U.S. Healthcare System Exam 1 (quiz questions)

View Set