C++ Chapter 2 Quizlet

25 July 2022
4.7 (114 reviews)
49 test answers

Unlock all answers in this set

Unlock answers (45)
question
In a C++ program, two slash marks ( // ) indicate:
answer
The beginning of a comment
question
A statement that starts with a # symbol is called a:
answer
Preprocessor directive
question
For every opening brace in a C++ program, there must be a:
answer
Closing brace
question
The ________ is/are used to display information on the computer's screen.
answer
cout object
question
The ________ causes the contents of another file to be inserted into a program.
answer
#include directive
question
________ represent storage locations in the computer's memory.
answer
Variables
question
These are data items whose values do not change while the program is running.
answer
Literals
question
You must have a ________ for every variable you intend to use in a program.
answer
definition
question
Of the following, which is a valid C++ identifier?
answer
All of these are valid identifiers.
question
The numeric data types in C++ can be broken into two general categories:
answer
integer and floating point
question
Besides decimal, two other number systems you might encounter in C++ programs are:
answer
Hexadecimal and Octal
question
A character literal is enclosed in ________ quotation marks, whereas a string literal is enclosed in ________ quotation marks.
answer
single, double
question
In memory, C++ automatically places a ________ at the end of string literals.
answer
Null terminator
question
Which escape sequence causes the cursor to move to the beginning of the current line?
answer
r
question
What is the modulus operator?
answer
%
question
Which data type typically requires only one byte of storage?
answer
char
question
What is the output of the following statement?
answer
12
question
In programming terms, a group of characters inside a set of quotation marks is called a:
answer
String literal
question
This is used to mark the end of a complete C++ programming statement.
answer
Semicolon
question
________ must be included in any program that uses the cout object.
answer
The header file iostream
question
If you use a C++ key word as an identifier, your program will:
answer
not compile
question
What is the value of cookies after the execution of the following statements?
answer
2
question
This function in C++ allows you to identify how many bytes of storage on your computer system an integer data value requires.
answer
sizeof
question
Character constants in C++ are always enclosed in ________.
answer
'single quotation marks'
question
These are used to declare variables that can hold real numbers.
answer
Floating point data types
question
The float data type is considered ________ precision, and the double data type is considered ________ precision.
answer
single, double
question
A variable whose value can be either true or false is of this data type.
answer
bool
question
Which of the following correctly consolidates the following declaration statements into one statement?
answer
int x = 7, y = 16, z = 28;
question
A variable's ________ is the part of the program that has access to the variable.
answer
scope
question
Every complete C++ program must have a ________.
answer
function named main
question
This control sequence is used to skip over to the next horizontal tab stop.
answer
t
question
Which one of the following would be an illegal variable name?
answer
3dGraph
question
Which line(s) in this program cause output to be displayed on the screen?
answer
14
question
Which of the following defines a double-precision floating point variable named payCheck?
answer
double payCheck;
question
What will the following code display?
answer
MondayTuesdayWednesday
question
What will the following code display?
answer
The number is number
question
What will the following code display?
answer
012
question
What will the following code display?
answer
Four score and seven years ago
question
What will the following code display?
answer
Four score and seven/nyearsago
question
What will the following code display?
answer
Fourscore andseven yearsago
question
Assume that a program has the following variable definition:
answer
letter = 'Z';
question
What will the value of x be after the following statements execute?
answer
4
question
What will the value of x be after the following statements execute?
answer
4
question
What will the value of x be after the following statements execute?
answer
2
question
Assuming you are using a system with 1-byte characters, how many bytes of memory will the following string literal occupy?
answer
8
question
The first step in using the string class is to #include the ________ header file.
answer
string
question
Assume that a program has the following string object definition:
answer
name = "Jane";
question
In C++ 11, if you want an integer literal to be treated as a long long int, you can append ________ at the end of the number.
answer
LL
question
In C++ 11, the ________ tells the compiler to determine the variable's data type from the initialization value.
answer
auto key word