EOC STUDY GUIDE PT.1
Variables
1. A statement that starts with a hashtag (or pound) symbol (#) is called a
a. Comment
b. Function
c. preprocessor directive
d. header file
e. None of these
2. For every opening brace ({) in a C++ program, there must be a
a. string literal
b. Function
c. Comment
d. closing brace
e. None of these
3. The __________ is(are) used to display information on the computer's screen.
a. opening and closing braces
b. opening and closing quotation marks
c. cout object
d. Backslash
e. None of these
4. In the following statement, the characters Hello! are a(n) cout << "Hello!";
a. Variable
b. string literal
c. Comment
d. Object
e. None of these
5. The __________ causes the content of another file to be inserted into a program.
a. cout object
b. double slash (//)
c. #include directive
d. semicolon (;)
e. None of these
,6. Which of the following must be included in any program that uses the cout object?
a. opening and closing braces
b. the header file iostream
c. Comments
d. a namespace
e. None of these
7. Character constants in C++ are always enclosed in
a. brackets ( < > )
b. braces ( { } )
c. single quotation marks ( ' ' )
d. pound sign and semicolon ( # ; )
e. Any of these
8. Every complete C++ program must have a
a. Comment
b. function named main
c. symbolic constant
d. cout statement
e. None of these
9. What will the following code display?
cout << "Monday";
cout << "Tuesday";
cout << "Wednesday";
a. Monday
Tuesday
Wednesday
b. Monday Tuesday Wednesday
c. MondayTuesdayWednesday
d. "Monday"
"Tuesday"
"Wednesday"
e. "Monday" "Tuesday" "Wednesday"
10. What will the following code display?
int number = 23;
cout << "The number is " << "number" << endl;
a. The number is 23
b. The number is23
c. The number is number
, d. The number is null
e. The number is
11. What will the following code display?
cout << "Roses " << "are red";
cout << "and " << "violets/n"
cout << "are" << "blue" << endl;
a. Roses are red
and violets
are blue
b. Roses are red and violets/nare blue
c. Roses are redand violets/nareblue
d. Roses are red and violets/n are blue
12. A(n) __________ represents a storage location in the computer's memory.
a. Literal
b. Variable
c. Comment
d. Integer
e. None of these
13. Data items whose values do not change while the program is running are
a. Literals
b. Variables
c. Characters
d. Integers
e. None of these
14. A variable definition tells the computer
a. the variable's name and its value
b. the variable's data type and its value
c. the variable's name and the type of data it will hold
d. whether the variable is an integer or a floating-point number
e. None of these
15. What will the following code display?
int x = 23, y = 34, z = 45;
cout << x << y << z << endl;
a. 23 34 45
b. 23
Variables
1. A statement that starts with a hashtag (or pound) symbol (#) is called a
a. Comment
b. Function
c. preprocessor directive
d. header file
e. None of these
2. For every opening brace ({) in a C++ program, there must be a
a. string literal
b. Function
c. Comment
d. closing brace
e. None of these
3. The __________ is(are) used to display information on the computer's screen.
a. opening and closing braces
b. opening and closing quotation marks
c. cout object
d. Backslash
e. None of these
4. In the following statement, the characters Hello! are a(n) cout << "Hello!";
a. Variable
b. string literal
c. Comment
d. Object
e. None of these
5. The __________ causes the content of another file to be inserted into a program.
a. cout object
b. double slash (//)
c. #include directive
d. semicolon (;)
e. None of these
,6. Which of the following must be included in any program that uses the cout object?
a. opening and closing braces
b. the header file iostream
c. Comments
d. a namespace
e. None of these
7. Character constants in C++ are always enclosed in
a. brackets ( < > )
b. braces ( { } )
c. single quotation marks ( ' ' )
d. pound sign and semicolon ( # ; )
e. Any of these
8. Every complete C++ program must have a
a. Comment
b. function named main
c. symbolic constant
d. cout statement
e. None of these
9. What will the following code display?
cout << "Monday";
cout << "Tuesday";
cout << "Wednesday";
a. Monday
Tuesday
Wednesday
b. Monday Tuesday Wednesday
c. MondayTuesdayWednesday
d. "Monday"
"Tuesday"
"Wednesday"
e. "Monday" "Tuesday" "Wednesday"
10. What will the following code display?
int number = 23;
cout << "The number is " << "number" << endl;
a. The number is 23
b. The number is23
c. The number is number
, d. The number is null
e. The number is
11. What will the following code display?
cout << "Roses " << "are red";
cout << "and " << "violets/n"
cout << "are" << "blue" << endl;
a. Roses are red
and violets
are blue
b. Roses are red and violets/nare blue
c. Roses are redand violets/nareblue
d. Roses are red and violets/n are blue
12. A(n) __________ represents a storage location in the computer's memory.
a. Literal
b. Variable
c. Comment
d. Integer
e. None of these
13. Data items whose values do not change while the program is running are
a. Literals
b. Variables
c. Characters
d. Integers
e. None of these
14. A variable definition tells the computer
a. the variable's name and its value
b. the variable's data type and its value
c. the variable's name and the type of data it will hold
d. whether the variable is an integer or a floating-point number
e. None of these
15. What will the following code display?
int x = 23, y = 34, z = 45;
cout << x << y << z << endl;
a. 23 34 45
b. 23