Exam 5: Loops and Files

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

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

(Multiple Choice)
4.9/5
(31)

When the increment operator precedes its operand, as in ++num1, the expression is in this mode.

(Multiple Choice)
4.8/5
(45)

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

(True/False)
4.7/5
(38)

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

(Multiple Choice)
5.0/5
(41)

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

(Multiple Choice)
4.9/5
(37)

Something within a while loop must eventually cause the condition to become false, or a(n) __________ results.

(Multiple Choice)
4.8/5
(41)

The while loop is this type of loop.

(Multiple Choice)
4.9/5
(40)

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

(Multiple Choice)
4.8/5
(41)

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

(Multiple Choice)
4.7/5
(38)

This may be used to write information to a file.

(Multiple Choice)
4.9/5
(43)

The condition that is tested by a while loop must be enclosed in parentheses and terminated with a semicolon.

(True/False)
4.9/5
(39)

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

(Multiple Choice)
4.8/5
(38)

This statement may be used to stop a loop's current iteration and begin the next one.

(Multiple Choice)
4.9/5
(25)

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

(Multiple Choice)
4.9/5
(41)

A file must be ________ before data can be written to or read from it.

(Multiple Choice)
5.0/5
(38)

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

A loop that is inside another loop is called:

(Multiple Choice)
4.7/5
(40)

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

(Multiple Choice)
4.8/5
(43)

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

(True/False)
4.9/5
(38)

The while loop has two important parts: an expression that is tested for a true or false value, and:

(Multiple Choice)
4.8/5
(43)
Showing 21 - 40 of 62
close modal

Filters

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