Exam 5: Loops and Files
Exam 1: Introduction to Computers and Programming44 Questions
Exam 2: Introduction to C++56 Questions
Exam 3: Expressions and Interactivity44 Questions
Exam 4: Making Decisions53 Questions
Exam 5: Loops and Files62 Questions
Exam 6: Functions49 Questions
Exam 7: Arrays53 Questions
Exam 8: Searching and Sorting Arrays20 Questions
Exam 10: Characters, C++-Strings, and More About the String Class42 Questions
Exam 11: Structured Data43 Questions
Exam 11: Structured Data50 Questions
Exam 12: Advanced File Operations38 Questions
Exam 13: Introduction to Classes46 Questions
Exam 14: More About Classes40 Questions
Exam 15: Inheritance, Polymorphism, and Virtual Functions38 Questions
Exam 16: Exceptions, Templates, and the Standard Template Library STL39 Questions
Exam 17: Linked Lists40 Questions
Exam 18: Stacks and Queues46 Questions
Exam 19: Recursion21 Questions
Exam 20: Binary Trees38 Questions
Select questions type
The do-while loop is a __________ loop that is ideal in situations where you always want the loop to iterate at least once.
Free
(Multiple Choice)
4.8/5
(36)
Correct Answer:
A
This is a variable that is regularly incremented or decremented each time a loop iterates.
Free
(Multiple Choice)
4.9/5
(41)
Correct Answer:
B
This loop is a good choice when you know how many times you want the loop to iterate in advance of entering the loop.
Free
(Multiple Choice)
4.8/5
(40)
Correct Answer:
C
What will the following code display? int x = 0;
For (int count = 0; count < 3; count++)
x += count;
cout << x << endl;
(Multiple Choice)
4.9/5
(39)
How many times will the following loop display "Hello"?
for (int i = 0; i <= 20; i++)
cout << "Hello!" << endl;
(Multiple Choice)
4.9/5
(36)
A while loop is somewhat limited, because the counter can only be incremented by one each time through the loop.
(True/False)
4.8/5
(40)
What will the following loop display?
int x = 0;
while (x < 5)
{
cout << x << endl;
x++;
}
(Multiple Choice)
4.8/5
(43)
How many times will the following loop display "Hello"?
for (int i = 0; i < 20; i++)
cout << "Hello!" << endl;
(Multiple Choice)
5.0/5
(50)
A for statement contains three expressions: initialization, test, and
(Multiple Choice)
4.8/5
(36)
To read data from a file, you define an object of this data type.
(Multiple Choice)
4.8/5
(37)
What will the following code display?
int number = 6;
cout << number++ << endl;
(Multiple Choice)
4.9/5
(39)
To write data to a file, you define an object of this data type.
(Multiple Choice)
5.0/5
(35)
What will the following code display?
int number = 6;
int x = 0;
x = number--;
cout << x << endl;
(Multiple Choice)
4.9/5
(29)
This statement may be used to stop a loop's current iteration and begin the next one.
(Multiple Choice)
4.8/5
(41)
The increment and decrement operators can be used in mathematical expressions; however, they cannot be used in relational expressions.
(True/False)
4.8/5
(42)
Assuming dataFile is a file stream object, the statement dataFile.close();
(Multiple Choice)
4.9/5
(34)
Showing 1 - 20 of 62
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)