Ch 2 Quiz

25 July 2022
4.7 (114 reviews)
36 test answers

Unlock all answers in this set

Unlock answers (32)
question
b. The beginning of a comment
answer
In a C++ program, two slash marks ( // ) indicate: Select one: 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 these
question
c. Preprocessor directive
answer
A statement that starts with a # symbol is called a: Select one: a. Comment b. Function c. Preprocessor directive d. Key word e. None of these
question
d. Closing brace
answer
For every opening brace in a C++ program, there must be a: Select one: a. String literal b. Function c. Variable d. Closing brace e. None of these
question
c. cout object
answer
The ________ is/are used to display information on the computer's screen. Select one: a. Opening and closing braces b. Opening and closing quotation marks c. cout object d. Backslash e. None of these
question
d. #include directive
answer
The ________ causes the contents of another file to be inserted into a program. Select one: a. Backslash b. Pound sign c. Semicolon d. #include directive e. None of these
question
b. Variables
answer
________ represent storage locations in the computer's memory. Select one: a. Literals b. Variables c. Comments d. Integers e. None of these
question
a. Literals
answer
These are data items whose values do not change while the program is running. Select one: a. Literals b. Variables c. Comments d. Integers e. None of these
question
b. definition
answer
You must have a ________ for every variable you intend to use in a program. Select one: a. purpose b. definition c. comment d. constant e. None of these
question
e. All of these are valid identifiers.
answer
Of the following, which is a valid C++ identifier? Select one: a. June1997 b. _employee_number c. ___department d. myExtraLongVariableName e. All of these are valid identifiers.
question
c. integer and floating point
answer
The numeric data types in C++ can be broken into two general categories: Select one: a. numbers and characters b. singles and doubles c. integer and floating point d. real and unreal e. None of these
question
b. Hexadecimal and Octal
answer
Besides decimal, two other number systems you might encounter in C++ programs are: Select one: a. Octal and Fractal b. Hexadecimal and Octal c. Unary and Quaternary d. Base 7 and Base 9 e. None of these
question
d. single, double
answer
A character literal is enclosed in ________ quotation marks, whereas a string literal is enclosed in ________ quotation marks. Select one: a. double, single b. triple, double c. open, closed d. single, double e. None of these
question
c. Null terminator
answer
n memory, C++ automatically places a ________ at the end of string literals. Select one: a. Semicolon b. Quotation marks c. Null terminator d. Newline escape sequence e. None of these
question
a. r
answer
Which escape sequence causes the cursor to move to the beginning of the current line? Select one: a. r b. b c. t d. n e. a
question
a. %
answer
What is the modulus operator? Select one: a. % b. * c. || d. + e. &
question
d. char
answer
Which data type typically requires only one byte of storage? Select one: a. float b. double c. int d. char e. short
question
a. String literal
answer
In programming terms, a group of characters inside a set of quotation marks is called aNo: Select one: a. String literal b. Variable c. Operation d. Statement e. None of these
question
b. Semicolon
answer
This is used to mark the end of a complete C++ programming statement. Select one: a. Pound Sign b. Semicolon c. Data type d. Void e. None of these
question
b.
answer
Which character signifies the beginning of an escape sequence? Select one: a. // b. c. { d. / e. #
question
b. The header file iostream
answer
________ must be included in any program that uses the cout object. Select one: a. Opening and closing braces b. The header file iostream c. Comments d. Escape sequences e. None of these
question
b. not compile
answer
If you use a C++ key word as an identifier, your program will: Select one: a. Execute with unpredictable results b. not compile c. understand the difference and run without problems d. Compile, link, but not execute e. None of these
question
e. sizeof
answer
This function in C++ allows you to identify how many bytes of storage on your computer system an integer data value requires. Select one: a. bytes b. f(x) c. int d. len e. sizeof
question
d. 'single quotation marks'
answer
Character constants in C++ are always enclosed in ________. Select one: a. (parentheses) b. {braces} c. [brackets] d. 'single quotation marks' e. "double quotation marks"
question
c. Floating point data types
answer
These are used to declare variables that can hold real numbers. Select one: a. Integer data types b. Real data types c. Floating point data types d. Long data types e. None of these
question
a. single, double
answer
The float data type is considered ________ precision, and the double data type is considered ________ precision. Select one: a. single, double b. float, double c. integer, double d. short, long e. None of these
question
b. bool
answer
A variable whose value can be either true or false is of this data type. Select one: a. binary b. bool c. T/F d. float e. None of these
question
c. scope
answer
A variable's ________ is the part of the program that has access to the variable. Select one: a. data type b. value c. scope d. reach e. None of these
question
a. function named main
answer
Every complete C++ program must have a ________. Select one: a. function named main b. comment c. symbolic constant d. preprocessor directive e. cout statement
question
c. t
answer
This control sequence is used to skip over to the next horizontal tab stop. Select one: a. ' b. n c. t d. h e. a
question
e. 3dGraph
answer
Which one of the following would be an illegal variable name? Select one: a. dayOfWeek b. itemsorderedforthemonth c. June1997 d. _employee_num e. 3dGraph
question
b. double payCheck;
answer
Which of the following defines a double-precision floating point variable named payCheck? Select one: a. Double payCheck; b. double payCheck; c. float payCheck; d. payCheck double;
question
c. 8
answer
Assuming you are using a system with 1-byte characters, how many bytes of memory will the following string literal occupy? "William" Select one: a. 14 b. 7 c. 8 d. 1
question
d. string
answer
The first step in using the string class is to #include the ________ header file. Select one: a. iostream b. cctype c. cmath d. string e. None of these
question
c. name = "Jane";
answer
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? Select one: a. name = (Jane); b. name = 'Jane'; c. name = "Jane"; d. name = Jane;
question
d. LL
answer
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. Select one: a. L b. c. I d. LL e. None of these
question
a. auto key word
answer
In C++ 11, the ________ tells the compiler to determine the variable's data type from the initialization value. Select one: a. auto key word b. #include preprocessor directive c. variable's name d. dynamic_cast key word e. None of these