Quiz 12

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

A problem can be solved with recursion if it can be broken down into successive smaller problems that are identical to the overall problem.

True

A function ___ is a statement that causes a function to execute.

call

Enclosing a group of statements inside a set of braces creates a(n) ___.

code block

In computer programming, ___ code is part of the source code of a program which can never be executed because there exists no control flow path to the code from the rest of the program.

dead or unreachable

__ arguments are passed to parameters automatically if no argument is provided in the function call.

default

A function ___ contains the interface to the function as well as the statements that make up the function.

definition

__ recursion is when a recursive function calls itself.

direct

__ is code that tests a function by simply calling it.

driver code

The order in which statements are executed in a program is referred to as the program's ___.

flow of execution

The list of parameters indicated in the function definition are called ___ parameters.

formal

A(n) ___ is a collection of statements that performs a specific task.

function

A(n) ___ is a programming construct that allows a programmer to associate a given set of instructions with a specific name.

function, procedure or subroutine

A(n) ___ constant is a named constant that is available to every function in a program.

global

A(n) ___ variable is defined outside all functions and is accessible to all functions in its scope.

global

The very first line of a function definition is the function ___.

header

_ involves writing and testing small portions of a program repeatedly until the program is complete.

incremental development

__recursion occurs when function A calls function B, which in turn calls function A. There can even be several functions involved in the recursion. For example, function A could call function B, which could call function C, which calls function A.

indirect

A(n) ___ is a collection of precompiled routines that a program can use.

library

A(n) ___ is a package of code that is meant to be reused by many programs.

library

A(n) ___ variable is defined inside a function and is not accessible outside the function.

local

Variables that are defined inside a function are called ___ variables.

local

Instead of writing one long program that contains all of the statements necessary to solve a problem, several small functions that each solve a specific part of the problem can be written. A program of this type is called a(n) ___ program.

modular

Function ___ is a programming concept that allows programmers to define two or more functions with the same name as long as each of the functions has a unique signature.

overloading

A(n) ___ is a special variable that holds a value being passed into a function.

parameter

When a reference variable is used as a parameter, it is said that the argument is ___.

passed by reference

When a copy of an argument is passed to a function, it is said to be ___.

passed by value

In programming, a function is a named section of a program that performs a specific task. In this sense, a function is a type of [a] or [b]. Some programming languages make a distinction between a function, which returns a value, and a procedure, which performs some operation but does not return a value.

procedure, subroutine

A function ___ eliminates the need to place a function definition before all calls to the function.

prototype

A ___ function is one that calls itself.

recursive

When used as parameters, ___ variables allow a function to access the parameter's original argument. Changes to the parameter are also made to the argument.

reference

A function can send a value to the part of the program that executed it. This value is called a(n) ___ value

return

Variables that are defined inside a function that remain in memory after the function has finished executing are called ___ variables.

static

__ local variables exist for the lifetime of the program, even though their scope is only the function in which they are defined.

static

A(n) ___ is a dummy function that is called instead of the actual function it represents. It usually displays a test message acknowledging that it was called, and nothing more.

stub

A(n) ___ function is a function that does not return a value to the part of the program that executed it.

void

Any problem that can be solved recursively can also be solved iteratively, with a loop. In fact, recursive algorithms are usually less efficient than iterative algorithms. This is because a function call requires several actions to be performed by the C++ runtime system. These actions include allocating memory for parameters and local variables and storing the address of the program location where control returns after the function terminates. These actions, which are sometimes referred to as overhead, take place with each function call. Such overhead is not necessary with a loop.

True

Values that are sent to a function are called [a] (a.k.a. [b]).

arguments, actual parameters

The ___ is the part of a calculation that can be solved without recursion. This stops the recursive function from continuing to call itself.

base case

The ___ of a function is the set of statements that perform the function's operation.

body


Conjuntos de estudio relacionados

Ch. 2 Smartbook - Managing Public Issues & Stakeholder Relationships

View Set

CHAPTER 7 SAMPLING AND SAMPLING DISTRIBUTIONS

View Set

Downward, Upward, and Lateral Communication

View Set