Ch. 4, Ch. 5 Test, Unit 6

Ace your homework & exams now with Quizwiz!

The C++ function ________ calculates the largest whole number that is less than or equal to x.

floor(x)

The primary purpose of the ____ loop is to simplify the writing of counter-controlled loops.

for

Putting one control structure inside another is called ____.

nesting

When using a reference parameter, a constant value or an expression cannot be passed to a ________ parameter.

nonconstant reference

The most common error associated with loops is a(n) _____ error.

off-by-one

When C++ evaluates a logical expression, any nonzero value is treated as _____.

true

The C++ function pow has ________ parameters.

two

The operator ! is ____, so it only has one operand.

unary

In a for structure, the _____ statement is executed after the continue statement, and before the loop condition executes.

update

A formal parameter is a ________ .

variable declared in the function header

An actual parameter is a ________ .

variable or expression listed in a call to a function

Which of the following operators has the highest order of precedence?

!

When a program reads past the end of the input file, the expression ____ becomes false.

!infile.eof()

Which of the following expressions evaluates to true? a

"Air" < "An"

You can disable assert statements by using the preprocessor directive ____.

#define NDEBUG

Which of the following statements is TRUE?

The value of a global named constant cannot be changed during program execution.

________ parameters provide a one-way link between actual parameters and formal parameters.

Value

A ____ statement causes an immediate exit from the switch structure.

break

The _____ statement is an effective way to avoid extra variables to control a loop and produce elegant code.

break

When the ____ statement executes in a repetition structure, it immediately exits from the structure.

break

The specification of the assert function is found in the header file ____.

cassert

Which of the following expressions evaluates to true? b

(14 >= 5) && ('A' < 'B')

Given the input stream variable cin, the expression ____ evaluates to true if the last input succeeded.

(cin)

When using a return statement, the return of any value other than ____ indicates that something went wrong during program execution.

0

Which of the following is a Fibonacci sequence?

1,1,2,3,5,8

Which of the following is the "less than or equal to" operator in C++?

<=

Which of the following statements is TRUE?

A call to a void function is a standalone statement.

Which of the following statements is true of a value-returning function?

A return statement can only return one value.

Which of the following statements is TRUE?

If the loop condition in a for loop is initially false, the loop body does not execute

_____ operators enable you to combine logical expressions.

Logical

Which of the following is NOT a reserved word in C++?

Select

Which of the following statements is FALSE?

You can assign a constant value as a default value to a reference parameter.

A variable for which memory is allocated at block entry and deallocated at block exit is called a(n) ________ variable.

automatic

The heading of a function includes all of the following EXCEPT the ________ .

code required to accomplish the task

To permit more than one statement to execute if an expression evaluates to true, C++ provides a structure called a ____ statement.

compound

In C++, the ____ operator, written as ?: is a ternary operator.

conditional

When the ____ statement executes in a repetition structure, it skips the remaining statements in the loop and proceeds with the next iteration of the loop.

continue

The function rand() is defined in the header file ____.

cstdlib

The function time is defined in the header file ____.

ctime

Which of the following is the general form of the do...while statement?

do statement while (expression);

The ____ loop is a posttest loop.

do...while

A program that tests a function is called a ________ program.

driver

In C++, the symbol ==, which consists of two equal signs, is called the ____ operator.

equality

A call to a value-returning function with an empty formal parameter list has the form ________ .

functionName()

If the possible range of values for a multiple selection statement cannot be reduced to a finite set of values, you must use the ____ structure.

if ... else

The tolower function takes one parameter of type ________ .

int

You can use either a(n) ___ variable or a bool variable to store the value of a logical expression.

int

The value of the expression in a switch statement must be a(n) ____.

integral

The C++ eof function is a member of the data type ____.

istream

Which of the following is the syntax for using the eof function?

istreamVar.eof()

In the statement, while (cin), the variable cin acts as the ____.

loop control variable

A ________ parameter is a formal parameter that receives the location (memory address) of the corresponding actual parameter.

reference

Stream variables should be passed by ________ to a function.

reference

In C++, :: is called the scope ________ operator.

resolution

The ________ of an identifier refers to where in the program an identifier is accessible.

scope

A _____ is a special value that marks the end of the input data.

sentinel

In ____ evaluation, the computer evaluates a logical expression from left to right and stops as soon as the value of the expression is known.

short-circuit

If a function is overloaded, then in a call to that function, the ________ determines which function to execute.

signature

A semicolon at the end of a for statement _____ the for loop.

terminates

The _____ loop is a pretest loop.

while


Related study sets

Quizlet Chemistry Comp, Electrolysis (IGCSE), Electrolysis - IGCSE, Chemistry - Electrolysis, Electrolysis, Oxidation, Oxidation Numbers, Balancing oxidation-reduction equations, Redox Reactions, Redox Reaction, Balancing Chemical Equations, Balancin...

View Set

Essential Vocabulary - Palabras para la clase de español Hola -Hello.

View Set

Chapter 55: Care of Patients with Stomach Disorders

View Set

Chapter 2 review (Fundamentals of Nursing)

View Set