Ch.2 Practice Quiz
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?
name= "Jane";
If you use the C++ key word as an identifier your program will:
not compile
In programming terms, a group of characters inside a set of quotation marks is called a:
string literal
In C++ program, two slash marks (//) indicate:
the beginning of a comment
if you use C++ key word as an identifier, your program will:
not compile
In memory C++ automatically places a ____ at the end of string literals.
null terminator
A statement that starts with a # is called a:
preprocessor directive
A variables ___ is the part of the program that has the access to the variables
scope
The float data type is considered _____ precision, and the double data type is considered ____ precision
single double
The _____ causes the contents of another file to be inserted into a program
#include directive
Character constants in C++ are always enclosed in:
'single quotation marks'
in the C++ instruction, int=number=38, children=4, cookies; cookies= number % children; what is the value of cookies after the execution of the statement?
2
Off the following, which is a valid c++ identifier? employee_number June1997 __department myExtraLongVariableName
all of these are valid identifiers
A variable whose value can be either true or false of this data type
bool
For every opening brace in C++, there must be a
closing brace
The ___ is/are used to display information on the computers screen
cout object
Every complete C++ program must have a __________.
function named main
How would you consolidate the following statement into one statement? int x = 7; int y = 16; int z = 28;
int x = 7, y=16,z=28;
The numeric data types in C++ can be broken in two general categories:
integer and floating point
Assuming you are using a system with 1-byte characters, how many bytes of memory will the following string literal occupy? "William"
8
Besides decimal, two other number systems you might encounter in C++ programs are;
Hexadecimal and Octal
Assume that a program has the following variable definition char letter; Which of the following statements correctly assigns the character Z to the variable?
letter= 'Z'
These are data items whose values do not change while the program is running
literals
These are data items whose values do not change while the program is running:
literals