module 4 - c++
These are operators that add and subtract one from their operands plus and minus ++and-- binary and unary conditional and relational binary and ternary
++and--
How many times will the following loop display "Looping again!"? 20 19 21 an infinite number of times
21
What will the following code display?int number = 6; number++; cout << number << endl; 6 5 7 0
7
In the following statement, which operator is used first? while (x++ < 10) ++ < neither; the expression is invalid cannot tell without the rest of the code
<
The statements in the body of a while loop may never be executed while the statements in the body of a do-while loop will be executed at least once at least twice never as many times as the user wishes None of these
at least once
A statement that causes a loop to terminate early is break terminate re-iterate continue None of these
break
The ________ loop is a good choice when you know how many times you want the loop to iterate in advance of entering the loop. pre-test for do-while while switch
for
The __________ loop is a good choice when you know how many times you want the loop to iterate in advance of entering the loop while for switch do-while pre-test
for
This means to increase a value: decrement increment modulus parse None of these
increment
This is a control structure that causes a statement or group of statements to repeat. decision statement loop cout object selection structure None of these
loop
To write data to a file, you define an object of the ________ data type. ifstream outputFile fstream ofstream
ofstream
A file __________ is a small holding section of memory that file-bound information is first written to name number buffer segment None of these
buffer
Something within a while loop must eventually cause the condition to become false or a(n) ________ results. null value infinite loop unexpected exit compiler error None of these
infinite loop
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? number >> outFile; outFile >> number; write(outFile, number); outFile << number;
outFile << number;
A special value that marks the end of a list of values is a constant counter variable sentinel None of these
sentinel