Programming Fundamentals - Quiz 5

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

How many times will the following loop display "Hello"? for (int i = 0; i <= 20; i++) cout << "Hello!" << endl;

21

What will the following code display? int number = 6 int x = 0; x = --number; cout << x << endl;

5

What will the following code display? int number = 6; int x = 0; x = number--; cout << x << endl;

6

What will the following code display? int number = 6; number++; cout << number << endl;

7

Look at the following statement. while (x++ < 10) which operand is used first?

<

How many times will the following loop display "Hello"? for (int i = 20; i >0; i--) cout << "Hello!" << endl;

An infinite number of times

T/F: The scope of a variable declared in a for loop's initialization expression always extends beyond the body of the loop.

False

T/F: You may not use the break and continue statements within the same set of nested loops

False

T/F: You may not use the break statement in a nested loop.

False

T/F: The update expression of a for loop can contain more than one statement, e.g. counter++, total += sales.

True

A loop that is inside another loop is called:

a nested loop

This statement causes a loop to terminate early.

break

A file _________ is a small holding section of memory that file-bound information is first written to.

buffer

Assuming dataFile is a file stream object, the statement: dataFile.close( );

closes a file

This is a variable that is regularly incremented or decremented each time a loop iterates.

counter

To allow file access in a program, you must #include this header file

fstream

In a for statement, this expression is executed only once.

initialization

The while loop contains an expression that is tested for a true or false value, and a statement or block that is repeated as long as the expression:

is true

This is a control structure that causes a statement or group of statements to repeat.

loop

To write data to a file, you define an object of this data type.

ofstream

The do-while loop is a(n) ____________ loop that is ideal in situations where you always want the loop to iterate at least once.

post-test

The do-while loop is considered a(n) ______________ loop.

post-test

This operator increments the value of its operand, then uses the value in context.

prefix increment

A for statement contains three expressions: initialization, test, and

update


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

Digestive and Gastrointestinal Function

View Set

Chapter 12 (MN) - Postpartal Period: Physiological Assessments and Nursing Care

View Set

Chapter 3: The U.S. Constitution

View Set