CSP 031A C++ Programming I Midterm
The ________ causes the contents of another file to be inserted into a program.
#include directive
. Every complete C++ program must have a ________.
. function named main
What is the output of the following statement? cout << 4 * (15 / (1 + 3)) << endl;
12
Which line(s) in this program cause output to be displayed on the screen?
16
What will be the output printed in line #11 in program below?
2
What will be the output of line 15?
4
What will be the output printed in line #11 in program below?
4
. For every opening brace in a C++ program as shown in line #7, there must be a _______________ :
Closing brace
What will the following code display? cout << "Monday"; cout << "Tuesday"; cout << "Wednesday";
MondayTuesdayWednesday
. The statement that starts with a # symbol as shown in line #2 is called a:
Preprocessor directive
. A group of characters inside a set of double quotation marks, as shown in line #8, is called a(n):
String literal
. What is purpose of \n in line #8?
Take cursor to next line
What is the purpose of two slash marks ( // ) in line #8 ?
The beginning of a comment
. What will be output generated in line #9 in program below?
The number is number
In the C++ program above, there might be an error in line #4. What is this error?
Using of reserve word int
Of the following, which is a valid C++ identifier?
_employee_number
A variable whose value can be either true or false is of this data type.
bool
Which of the following correctly consolidates the following declaration statements into one statement? int x = 7; int y = 16; int z = 28;
int x = 7, y = 16, z = 28;
. The C++ program above might have syntax error because ______________.
no semi-colon in line #5
A character literal is enclosed in ________ quotation marks, whereas a string literal is enclosed in ________ quotation marks.
single, double