Practice Test: Question Set - 29
1. C++ allows you to define the same functions more than once in the same program _________
- (A) If
the definitions are identical
- (B) If
the definitions are included in two separate #include files
- (C) If
the definitions are located in a single #include file that is included more
than once
- (D) C++
does not allow you to define the same functions more than once in the same
program
2. Each generic type in a template function definition is preceded by the keyword _________
- (A) Template
- (B) Function
- (C) Type
- (D) Class
3. Format flags may be combined using the _______
- (A) bitwise OR
operator(|)
- (B) logical OR
operator (||)
- (C) bitwise AND
operator (&)
- (D) logical AND
operator (&&)
4. When a child class function is called, the compiler looks first for a matching function name in the _______
- (A) Class of the
object using the function name
- (B) Immediate
ancestor class
- (C) Base class
- (D) Descendant
class
5. The declaration section holds
- (A) Data
members
- (B) Data
members and function prototypes
- (C) Data
members, function prototypes, and the functions themselves
- (D) None of the
above
6. Hiding individual components of an entry is _______
- (A) Polymorphism
- (B) Encapsulation
- (C) Scaling
- (D) Not
recommended in C++
7. A C++ program contains a function with the header int function(double d, char c). Which of the following function headers could be used within the same program?
- (A) char
function(double d, char c)
- (B) int
function(int d, char c)
- (C) Both (a) and
(b)
- (D) Neither (a)
nor (b)
8. Overloading involves writing two or more functions with ________
- (A) Different
names and different argument lists
- (B) Different
names and the same argument list
- (C) The same
name and different argument lists
- (D) The same
name and the same argument list
9. With communicational cohesion
- (A) A tasks and
the data are related
- (B) The tasks
are related; the data are not
- (C) The data are
related; the tasks are not
- (D) The tasks
and the data are unrelated
10. Which of the following is(are) invalid string constant(s)?
- (A) '7.15 pm'
- (B) "i like
e"
- (C) "7.3el2"
- (D) "1234el2"
11. The compiler determines the type used in a template function via ________
- (A) The name of
the function
- (B) The first
variable declared within the function
- (C) The
type of the argument passed to the function
- (D) The
type of the value returned from the function
12. A member function uses the correct object when you call it because
- (A) A copy of
the object is passed to the function
- (B) The
address of the object is passed to the function
- (C) The
address of the function is passed to another function
- (D) The
address of the object is returned from the function
13. Elements in an array are identified by a unique _______
- (A) Data type
- (B) Order
- (C) Subscript
- (D) Symbol
14. A function that changes the state of the cout object is called a(n) ________
- (A) Member
- (B) Adjuster
- (C) Manipulator
- (D) Operator
15. The arguments that determine the state of the cout object are called _______
- (A) Classes
- (B) Manipulators
- (C) Format flags
- (D) State
controllers
Next Tests: