Exam 5: Loops and Files

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

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

(Multiple Choice)
5.0/5
(42)

The statements in the body of a while loop may never be executed, whereas the statements in the body of a do-while loop will be executed:

(Multiple Choice)
4.8/5
(35)

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.8/5
(45)

If you want a user to enter exactly 20 values, which loop would be the best to use?

(Multiple Choice)
4.9/5
(41)

You may not use the break and continue statements within the same set of nested loops.

(True/False)
4.8/5
(30)

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

(Multiple Choice)
4.7/5
(35)

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

(Multiple Choice)
4.9/5
(36)

This is a special value that marks the end of a list of values.

(Multiple Choice)
4.8/5
(36)

This means to increase a value by one.

(Multiple Choice)
4.7/5
(36)

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

(Multiple Choice)
4.9/5
(35)

You may define a __________ in the initialization expression of a for loop.

(Multiple Choice)
4.8/5
(33)

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

(Multiple Choice)
4.9/5
(22)

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.

(Multiple Choice)
4.7/5
(30)

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

(Multiple Choice)
4.8/5
(40)

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

(Multiple Choice)
4.9/5
(32)

Multiple relational expressions cannot be placed into the test condition of a for loop.

(True/False)
4.9/5
(44)

An initialization expression may be omitted from the for loop if no initialization is required.

(True/False)
4.8/5
(43)

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

(True/False)
4.8/5
(37)

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

(True/False)
4.7/5
(27)

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

(True/False)
4.9/5
(37)
Showing 41 - 60 of 62
close modal

Filters

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