Chapter 5 Study Guide

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

What will the following code print? num = 5; cout << num++ << " "; cout << num-- << " "; cout << --num;

5 6 4

The while loop has two important parts: a condition that is tested and a statement or block of statements that is executed

As long as the condition is true

True/False: A while loop is somewhat limited because the counter can only be incremented or decremented by one each time through the loop.

False

True/False: You can nest a for loop inside another for loop, but cannot nest a while loop inside another while loop or a do-while loop inside another do-while loop.

False

The statements in the body of a do-while loop are executed

at least once

The ________ statement causes a loop to terminate early.

break

The -- operator

can be used in either prefix or postfix mode. is a unary operator. subtracts one from the value of its operand. must have an lvalue, such as a variable, as its operand. All the above are true

A(n) ________ is a variable that is regularly incremented or decremented each time a loop iterates.

counter

The ideal type of loop to use for repeating a menu is a(n) ________ loop. 18

do-while

The ideal type of loop to use if you want a user to enter exactly 20 values is a(n) ________ loop

for

To use files in a C++ program you must include the ________ header file.

fstream

1) To ________ a value means to increase it.

increment

If nothing within a while loop ever causes the condition to become false, a(n) ________ may occur.

infinite loop

A(n) ________ is a variable that controls the number of times a loop iterates.

loop control variable

The do-while loop is a(n) ________ loop, whereas the while loop is a(n) ________ loop.

post test, pretest

A for loop is considered a(n) ________ loop.

pretest

A(n) ________ is a special value that marks the end of a list of values.

sentinel

In order for a C++ program to read data from a file,

the file must already exist. the program must open the file. the program must define a file stream object that can "point to" (i.e., reference) the file. All of the above are required..

If a while loop has no braces around the body of the loop

the loop body contains just one statement

True/False: When a loop is nested inside another loop, the inner loop goes through all its iterations for each iteration of the outer loop.

true


संबंधित स्टडी सेट्स

EAQ Schizophrenia and Substance Abuse

View Set

Štátnice BSS(A): Vojenstvo a stratégie

View Set

Maternal Newborn Practice 2019 A

View Set

Microeconomics Chapter 20 Elasticity Prep

View Set

Exam 3 - Nclex Practice Questions

View Set