Chapter 3 Review
The proper initial value for a variable declared to be of the float data type would be ________.
0.0
What is the binary equivalent of the decimal number 7
0111
In all number systems, the result of raising the base number to the 0th power is _______.
1
Memory locations assigned the char data type can store ______ character(s).
1
The short data type can store a number in the range from -32,768 to +32,767. How many bytes of memory is required for the short data type?
2
What is the decimal equivalent of the binary number 110?
6
________ is a coding scheme that assigns a specific numeric code to each character on your keyboard.
ASCII
Camel case means capitalizing the entire name of a variable or named constant ( T or F )
False
If the value's data types does not match the memory location's data type, the computer uses a process called explicit type conversion to convert the value to fit the memory location ( T or F )
False
Number are represented in memory using the decimal number system ( T or F )
False
The name of a memory location in C++ can be a keyword ( T or F )
False
The name of a memory location in C++ can contain a space ( T or F )
False
The string data types is an example of a fundamental data type in C++
False
The value of a named constant is allowed to change during runtime ( T or F )
False
User-defined data types are the basic data types built into the C++ language ( T or F )
False
When naming a memory location in C++, names are not case sensitive ( T or F )
False
What happens in C++ when a real number is converted from one data type to another data type that can store only smaller numbers? Are there any potential consequences from this occurring? If so, please give an example.
It is demoted, yes it can completely change a numbers value and mess up the entire program. If you give the value 7.2 but put it in and integer syntax it is going to be demoted to 7.
Why are the names given to named constants usually spelled in all capitals in C++?
So you can tell it is a constant.
_______ refers to the rules of a programming language.
Syntax
A keyword is a word that has special meaning in the programming language in which you are using ( T or F )
True
A variable is a memory location whose value can change during runtime ( T or F )
True
Another name for fundamental data types are primitive data types ( T or F )
True
In C++, the float and double variable data types are used to store real numbers ( T or F )
True
The name of a memory location in C++, names must begin with a letter ( T or F )
True
The term syntax refers to the rules of a programming language ( T or F )
True
What is the primary difference between a variable and a named constant in C++?
Variables can change during runtime while named constants cannot.
Which of the following would be an invalid name for a memory location in C++? (write the correct letter for answer) a. 2ndname b. CiTy c. middle_name d. zip3Code
a
Which of the following data types can contain a real number? (write the correct letter for answer) a. int b. float c. bool d. char
b
Data is stored in memory using the _________ number system.
binary
All of the following are fundamental data types except _________. (write the correct letter for answer) a. short b. char c. string d. bool
c
Which of the following would be a valid name for a memory location in C++? (write the correct letter for answer) a. my.name b. 3oreos c. alB2c3D4 d. me&you
c
Which of the following would be a valid string literal constant? (write the correct letter for answer) a. string b. 'name' c. "string" d. empty string
c
When a variable's name contains two or more words, most C++ programmers enter the name using _________ ___________.
camel case
When declaring a named constant, the _________ keyword indicates that the memory location being declared cannot be changed during runtime.
const
All of the following are rules for naming a memory location in C++ except _________. ( write the correct letter for answer ) a. the name must begin with a letter b. the name cannot contain spaces c. the name cannot be a keyword d. names in C++ are not case sensitive
d
The ASCII value of the number zero would be _________. (write the correct letter for answer) a. 0 b. 0.0 c. either a or b d. none of the above
d
Which of the following is a string literal constant? (write the correct letter for answer) a. "" b. "&" c. "Hello" d. all of the above
d
Which of the following is a valid integer value? (write the correct letter for answer) a. 5.132456e+03 b. '9' c. 16.2 d. -123
d
When a numeric value is converted from one data type to another data type that can store smaller numbers, the value is said to be _________.
demoted
All numeric literal constants with a decimal place are treated as the ________ data type.
double
If the value's data type does not match the memory location's data type, the computer uses a process called _______ to convert the value to fit the memory location.
implicit type conversion
Assigning a beginning value to a memory location is referred to as _________.
initializing
A _________ is a word that has a special meaning in the programming language you are using.
keyword
A ________ __________ is not a memory location; rather, it is an item of data that can appear in a program instruction and can be stored in a memory location.
literal constant
A ________ is a memory location whose value cannot change during runtime.
named constant
When a numeric value is converted from one data type to another data type that can store larger numbers, the value is said to be _______.
promoted
A character literal constant is a single character enclosed in _________ quotation marks.
single
A ________ is a memory location whose values can change during runtime.
variable