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
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 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++)
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
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)