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
(75)

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
(96)

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

(Multiple Choice)
4.9/5
(90)

This means to increase a value:

(Multiple Choice)
4.9/5
(74)

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

(Multiple Choice)
4.9/5
(80)

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

(True/False)
4.8/5
(77)

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

(Multiple Choice)
4.9/5
(74)

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
(98)

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

(True/False)
4.8/5
(71)

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
(78)

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
(71)

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

(Multiple Choice)
4.9/5
(71)

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

(Multiple Choice)
4.8/5
(73)

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

(Multiple Choice)
4.9/5
(82)

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

(Multiple Choice)
4.7/5
(83)

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
(82)

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
(83)

A statement that causes a loop to terminate early is

(Multiple Choice)
4.9/5
(83)

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

(True/False)
4.8/5
(86)

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

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

Filters

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