Exam 5: Loops and Files

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

What will the following code display? Int x = 0; For (int count = 0; count < 3; count++) X += count; Cout << x << endl;

(Multiple Choice)
4.7/5
(37)

If you want to stop a loop before it goes through all of its iterations, the break statement may be used.

(True/False)
5.0/5
(40)

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

(Multiple Choice)
5.0/5
(44)

This means to increase a value:

(Multiple Choice)
4.9/5
(31)

What is the output of the following code segment? N = 1; While (n <= 5) Cout << n << ' '; N++;

(Multiple Choice)
4.9/5
(33)

A while loop's body can contain multiple statements, as long as they are enclosed in braces.

(True/False)
4.8/5
(36)

A statement that may be used to stop a loop's current iteration and begin the next one is

(Multiple Choice)
4.8/5
(28)

The __________ loop is a good choice when you know how many times you want the loop to iterate in advance of entering the loop.

(Multiple Choice)
4.9/5
(41)

It is possible to define a file stream object and open a file in one statement.

(True/False)
4.8/5
(32)

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?

(Multiple Choice)
4.9/5
(34)

The two important parts of a while loop are the expression that is tested for a true or False value and

(Multiple Choice)
4.8/5
(31)

These are operators that add and subtract one from their operands.

(Multiple Choice)
4.9/5
(36)

A special value that marks the end of a list of values is a

(Multiple Choice)
4.8/5
(31)

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

(Multiple Choice)
4.8/5
(34)

To allow file access in a program, you must use __________ in the header file.

(Multiple Choice)
4.8/5
(39)

If you place a semicolon after the test expression in a while loop, it is assumed to be a(n)

(Multiple Choice)
4.7/5
(41)

How many times will the following loop display "Looping again!"? For (int i = 0; i <= 20; i++) Cout << "Looping again!" << endl;

(Multiple Choice)
4.8/5
(34)

A statement that causes a loop to terminate early is

(Multiple Choice)
4.8/5
(35)

You may nest while and do-while loops but you may not nest for loops.

(True/False)
4.8/5
(30)

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

(Multiple Choice)
4.8/5
(44)
Showing 21 - 40 of 60
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)