Computer Science Quiz 2
Of the following, which is a valid C++ identifier? A) June1997 B) _employee_number C) ___department D) myExtraLongVariableName E) All of the above
E) All of the above
These are data items whose values do not change while the program is running A) Literals B) Variables C) Comments D) Integers E) None of the above
A) Literals
A preprocessor directive does not require a semicolon at the end A) True B) False
A) True
C++ does not have a built in data type for storing strings of characters A) True B) False
A) True
Escape sequences are always stored internally as a single character A) True B) False
A) True
Floating point constants are normally stored in memory as doubles name A) True B) False
A) True
When typing in your source code into the computer, you must be very careful since most of your C++ instructions, header files, and variable names are case sensitive A) True B) False
A) True
You must have a ___________ for every variable you intend to use in a program A) Purpose B) Definition C) Comments D) Constant E) None of the above
B) Definition
A variable called "average" should be declared as an integer data type because it will probably hold data that contains decimal places A) True B) False
B) False
If you do not follow a consistent programming style, your programs will generate compiler errors A) True B) False
B) False
If you use a C++ key word as an identifier, your program will compile, link, but not execute. A) True B) False
B) False
Real types are used to declare variables that can hold real numbers. A) True B) False
B) False
The C++ language standard requires that you give variables names that indicate what the variables are used for. A) True B) False
B) False
In a C++ program, two slash marks ( // ) indicate: A) The end of a statement B) The beginning of a comment C) The end of the program D) The beginning of a block of code E) None of the above
B) The beginning of a comment
_____________ represent storage locations in the computer's memory A) Literals B) Variables C) Comments D) Integers E) None of the above
B) Variables
The numeric data types in C++ can be broken into two general categories: A) numbers and characters B) Singles and doubles C) Integers and floating point D) real and unreal E) None of the above
C) Integers and floating point
A statement that starts with a # is called a: A) Comment B) Function C) Preprocessor directive D) Key word E) None of the above
C) Preprocessor directive
The ______ is/are used to display information on the computer's screen A) Opening and closing braces span B) Opening and closing quotation marks C) cout object D) Backslash E) None of the above
C) cout object
The _____ causes the contents of another file to be inserted into a program A) Backslash B) Pound sign C) Semicolon D) #include directive E) None of the above
D) #include directive
For every opening brace in a C++ program, there must be a: A) String literal B) Function C) Variable D) Closing brace E)None of the above
D) Closing brace