CS CHAPTER II
Assume that a program has the following string object definition: string name; which of the following statements correctly assigns a string literal to the string object?
B) name = "Jane";
___ must be included in any program that uses the cout object
B) The header file iostream
What will the following code display? int number = 7; cout << "The number is" << "number" << endl;
B) The number isnumber
___ represent storage locations in the computer's memory
B) Variables
Which of the following defines a double-precision floating point variable named payCheck
B) double payCheck
These are used to declare variables that can hold real numbers
C) Floating point data types
What is the value of cookies after the execution of the following statements? int = 38, children = 4, cookies; cookies = number % children;
A) 2
These are data items whose values do not change while the program is running
A) Literals
What is the output of the following statement? cout << 4*(15/(1+3)) << endl;
B) 12
Which one of the following would be an illegal variable name?
B) 3dGraph
A variable value can be either true or false is of this data type
B) Bool
You must have a ___ for every variable you intended to use in a program
B) Definition
True/False: If you do not follow a consistent programming will generate compiler errors:
B) False
Assuming you are using a system with 1-byte characters, how many bytes will the following string literal occupy? "william"
C) 8
What will the following code display? cout << "Four" << "score"; cout << "and" << "seven/n"; cout << "years" << "ago" << endl;
C) Fourscoreandseven/nyearsago
The numeric data types in c++ can be broken into two general categories
C) Integer and floating point
In memory, c++ automatically places a ___ at the en d of string literals
C) Null terminator
A statement that starts with a # symbol is called a:
C) Preprocessor directive
Which character signifies the beginning of an escape sequence?
C) \
This control sequence is used to skip over to the next horizontal tab stop
C) \t
Assume that program has the following variable definition: char letter; Which of the following statements correctly assigns the character z to the variable?
C) letter = 'z';
The ___ causes the contents of another file to be inserted into a program
D) #include directive
What will the following code display? int x= 0, y= 1, z= 2; cout << x << y << z << endl;
D) 012
Which data type typically requires only one byte of storage
D) Char
A character literal is enclosed in ___ quotation marks, whereas a string literal is enclosed in ___ quotation marks
D) Single, double
Which of the following correctly consolidates the following declaration statements into one statement? int x= 7; int y= 16; int z= 28;
D) int x= 7, y= 16, z= 28;
This function in c++ allows you to identify how many bytes of storage on your computer system an integer date value requires
E) Sizeof
What will the following code display? cout << "Monday"; cout << "Tuesday"; cout << "wednesday";
A) MondayTuesdayWednesday
The float type is considered ___ precision, and the double data type is considered ___ precision
A) Simple and double
In programming terms, a group of characters inside a set of quotation mark is called a(n) ___
A) String literal
True/False: When typing in your source do into the computer, you must be very careful since most of your c++ instructions, header files and variables are case sensitive;
A) True
If you use a c++ keyword as an identifier, your program will:
B) Not compile
This is used to mark the end of a complete c++ programming statement
B) Semicolon
True/False: The c++ language requires that you give variables names that indicate what the variables are used for:
B) False
Every complete c++ program must have a ___
B) Function named main