Practice Test: Question Set - 22
1. The generic type in a template function
- (A) Must be T
- (B) Can be T
- (C) Cannot
be T for functions you create, but may be for C++'s built-in functions
- (D) Cannot be T
2. If the description of function is "input the quantity, validate that the quantity is greater than 1, subtract 1 from the quantity, and print the quantity," the function is
- (A) Sequentially
cohesive
- (B) Logically
cohesive
- (C) Communicationally
cohesive
- (D) Functionally
cohesive
3. If a class will serve as a base class, most often the base class data members are
- (A) Private
- (B) Protected
- (C) Public
- (D) Polymorphic
4. The step-by-step instructions that solve a problem are called ________
- (A) An
algorithm
- (B) A list
- (C) A plan
- (D) A
sequential structure
5. The int type of constants are whole numbers in the range
- (A) - 23677 to
23678
- (B) - 32768 to
32767
- (C) - 32767 to
32768
- (D) - 32864 to
32865
6. Which of the following statements declares a variable that can contain a decimal number?
- (A) dec payRate;
- (B) dec
hourlyPay
- (C) float
payRate
- (D) float
hourlyPay;
7. What does C++ append to the end of a string literal constant?
- (A) A space
- (B) A number
sign (#)
- (C) An asterisk
(*)
- (D) A
null character
8. An unsigned double type of data
- (A) Can have
only positive values
- (B) Does not
exist
- (C) Is always
less than 1010
- (D) Can have
only negative values
9. To include the double quotes as part of the control string we use the symbol
- (A) %"
- (B) ""
- (C) \"
- (D) #
10. You define a structure type globally because ________
- (A) You save
many lines of code by not rewriting an identical structure definition in each
function that uses it
- (B) You will never
change its definition
- (C) It is
required in C++
- (D) All of the
above
11. A function that is called automatically each time an object is created is a(n)
- (A) Constructor
- (B) Contractor
- (C) Builder
- (D) Architect
12. The statement int n[4] = {11, -13, 17, 105};
- (A) Assigns the
value -13 to [2]
- (B) Assigns the
value 17 to n[2]
- (C) Is wrong; it
gives an error message
- (D) Assigns the
value 18 to n[2]
13. Sending a copy of data to a program module is called ________
- (A) Passing a
value
- (B) Making
a reference
- (C) Recursion
- (D) Setting
a condition
14. A derived class _______ override attributes of a parent class
- (A) May
- (B) May if the
two classes have the same name
- (C) Must
- (D) Must not
15. Variables that are declared in a block are known as _______ variables to that block
- (A) Confined
- (B) Local
- (C) Global
- (D) Immediate
Next Tests: