Gaddis - Starting out with C++ (8th Edition) - Ch. 5

Ace your homework & exams now with Quizwiz!

The break statement causes a loop to stop the current iteration and begin the next one.

False.

The cout statement in the following program segment will display 5: int x = 5; cout << ++x;

False.

The for loop is a post test loop.

False.

The operand of the increment and the decrement operators can be any valid mathematical expression.

False.

To calculate the total number of iterations of a nested loop, add the number of iterations of all the loops.

False.

A loop that evaluates its test expression after each repetition is an ______ loop.

posttest A loop that evaluates its test expression after each repetition is an posttest loop.

When the increment or decrement operator is placed before the operand (or to the operands left) the operator is being used in the ______ mode.

prefix When the increment or decrement operator is placed before the operand (or to the operands left) the operator is being used in the prefix mode.

A loop that evaluates its test expression before each repetition is an ______ loop.

pretest A loop that evaluates its test expression before each repetition is an pretest loop.

A ______ is a sum of numbers that accumulated with each iteration of a loop.

running total A running total is a sum of numbers that accumulated with each iteration of a loop.

A ______ is a special value that marks the end of a series of values.

sentinel A sentinel is a special value that marks the end of a series of values.

The ______ and ______ loops will not iterate at all if their test expressions are false to start with.

while and for The while and for loops will not iterate at all if their test expressions are false to start with.

In a nested loop, the outer loop executes faster than the inner loop.

False.

It is not necessary to initialize counter variable.

False.

One limitation of the for loop is that only one variable may be initialized in the initialization expression.

False.

The continue statement causes a terminated loop to resume.

False.

The do-whole loop is a pretest loop.

False.

A variable may be defined in the initialization expression of the for loop.

True.

A ______ is a variable that is initialized to some starting value, usually zero, and then has numbers added to it in each iteration of a loop.

accumulator An accumulator is a variable that is initialized to some starting value, usually zero, and then has numbers added to it in each iteration of a loop.

The ______ statement causes a loop to terminate immediately.

break

The______ loop is ideal for situations that require a counter.

for The for loop is ideal for situations that require a counter.

A loop that does not have a way of stopping is called an ______ loop.

infinite or endless A loop that does not have a way of stopping is called an endless loop.

Each repetition of a loop is known as a ______.

iteration Each repetition of a loop is known as an iteration.

All three of the for loops expressions may be omitted.

True.

In a nested loop, the break statement only interrupts the loop it is placed in.

True.

In a nested loop, the inner loop foes through all of its iterations for every single iteration of the outer loop.

True.

The cout statement in the following program segment will display 5: int x = 5; cout << x++;

True.

The while loop is a pretest loop.

True.

Variables may be defined inside the body of a loop.

True.

When you call an ofstream object's open member function, the specified file will be erased if it already exists.

True.

The statement or block that is repeated is known as the ______ of the loop.

body The statement or block that is repeated is known as the body of the loop.

The ______ statement causes a loop to skip the remaining statements in the current iteration.

continue

A ______ is a variable that counts the number of times a loop repeats.

counter A counter is a variable that counts the number of times a loop repeats.

The ______ loop always iterates at least once.

do-while The do-while loop always iterates at least once.

Inside the for loop's parentheses, the first expression is the ______, the second expression is the ______, and the third expression is the ______.

initialization, test, update Inside the for loop's parentheses, the first expression is the initialization, the second expression is the test, and the third expression is the update.

To ______ a value means to increase it by one and to ______ a value means to decrease by one.

increment, decrement To increment a value means to increase it by one and to decrement a value means to decrease by one.

A loop that is inside another is called a ______ loop.

nested A loop that is inside another is called a nested loop.

When the increment or decrement operator is placed after the operand (or to the operands right), the operand is being used in the ______ mode.

postfix When the increment or decrement operator is placed after the operand (or to the operands right), the operand is being used in the postfix mode.


Related study sets

TEPC 5000: An Overview of Teaching

View Set

Freshman Vocab Final (Good Luck)

View Set

The Value of Healthy Diet and Exercise

View Set

Abnormal Psychology Test 2- Chapter 8

View Set

A level English Language- Gender terminology

View Set