Chapter 2
The ________ causes the content of another file to be inserted into a program. cout object double slash (//) #include directive semicolon (;) None of these
#include directive
The preprocessor executes after the compiler.
False
What will the following code display?cout << "Four\n" << "score\n";cout << "and" << "\nseven";cout << "\nyears" << " ago" << endl; Four score and seven years ago Four score and sevenyears ago Fourscoreand sevenyears ago Four scoreand sevenyears ago
Four score and seven years ago
What will the following code display?cout << "Monday";cout << "Tuesday";cout << "Wednesday"; MondayTuesdayWednesday Monday Tuesday Wednesday MondayTuesdayWednesday "Monday""Tuesday""Wednesday" "Monday" "Tuesday" "Wednesday"
MondayTuesdayWednesday
What will the following code display?cout << "Roses " << "are red";cout << "and " << "violets/n"cout << "are" << "blue" << endl; Roses are red and violets are blue Roses are red and violets/nare blue Roses are redand violets/nareblue Roses are red and violets/n are blue
Roses are redand violets/nareblue
What will the following code display?int number = 23;cout << "The number is " << "number" << endl; The number is 23 The number is23 The number is number The number is null The number is
The number is number
A named constant is like a variable, but it its content cannot be changed while the program is running.
True
A value is stored in a variable with an assignment statement.
True
Programming style refers to the way a programmer uses elements such as identifiers, spaces, and blank lines.
True
The preprocessor reads a program before it is compiled and only executes those lines beginning with # symbol.
True
Which control sequence is used to skip over to the next horizontal tab stop? \n end1 \t \b \'
\t
The ________ is(are) used to display information on the computer's screen. opening and closing braces opening and closing quotation marks cout object backslash None of these
cout object
In a cout statement, which of the following will advance the output position to the beginning of the next line? endl or \n end1 or /n \n or \t \t or \b \\ or \'
endl or \n
Every complete C++ program must have a comment function named main symbolic constant cout statement None of these
function named main
A statement that starts with a hashtag (or pound) symbol (#) is called a comment function preprocessor directive header file None of these
preprocessor directive
Character constants in C++ are always enclosed in braces ( { } ) single quotation marks ( ' ' ) pound sign and semicolon ( # ; ) Any of these
single quotation marks ( ' ' )
In the following statement, the characters Hello! are a(n)cout << "Hello!"; variable string literal comment object None of these
string literal
In a C++ program, two slash marks (//) indicate the end of a statement the beginning of a comment the end of a program the beginning of a block of code None of these
the beginning of a comment
Which of the following must be included in any program that uses the cout object? opening and closing braces the header file iostream comments a namespace None of these
the header file iostream
A(n) ________ represents a storage location in the computer's memory. literal variable comment integer None of these
variable
Because C++ is case-sensitive, all programs must have a function called main or Main.
False
C++ 11 introduced an alternative way to define variables, using the template key word and an initialization value.
False
In C++ you are required to name your variables so they indicate the purpose they will be used for.
False
For every opening brace ({) in a C++ program, there must be a string literal function comment closing brace None of these
closing brace
In programming, the terms "line" and "statement" always mean the same thing.
False
C++ does not have a built-in data type for storing strings of data.
True
Escape sequences are always stored internally as a single character.
True
Floating point constants are normally stored in memory as doubles.
True
In C++, key words are written in all lowercase letters. Correct!
True
When typing your source code into the computer, you should be careful since most of your C++ instructions, header files, and variable names are case sensitive.
True