quiz 5 review

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

What is the output of the following code segment? n = 1; while (n <= 5) cout << n << ' '; n++;

1 forever

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

21

int x = 0; for (int count = 0; count < 3; count++) x += count; cout << x << endl;

3

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

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

ofstream

Assuming outFile is a file stream object and number is a variable, which statement writes the contents of number to the file associated with outFile?

outFile << number;

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

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

update

This is a pre-test loop that is ideal in situations where you do not want the loop to iterate if the condition is false from the beginning.

while


Kaugnay na mga set ng pag-aaral

chapter 26 nervous system infections mcgraw hill microbiology

View Set

Principles of Economics Chapter 34

View Set

Estate Planning: Chapter 7 Methods of Estate Transfer at Death

View Set

Multijurisdictional Tax Issues, Uses of Local/State Taxes, ACCT 570 - Ch 12: State & Local Taxes, 4400, Multi-Jurisdictional Tax, State and Local Taxation, Tax Law, Test 1: State Tax, Tax Chapter 23 - State and Local Taxes, Chapter 24, SALT Final, AC...

View Set

How can you manage risk using risk strategies?

View Set