Deck 15: Inheritance, Polymorphism, and Virtual Functions
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/40
Play
Full screen (f)
Deck 15: Inheritance, Polymorphism, and Virtual Functions
1
The ________ destructor is called before the ________ destructor.
A)base, derived
B)derived, base
C)public, private
D)private, public
E)None of these
A)base, derived
B)derived, base
C)public, private
D)private, public
E)None of these
derived, base
2
Multiple inheritance opens the opportunity for a derived class to have ________ members.
A)dynamic
B)private
C)public
D)ambiguous
E)None of these
A)dynamic
B)private
C)public
D)ambiguous
E)None of these
ambiguous
3
________ to a base class may be assigned the address of a derived class object.
A)Access specifiers
B)Static members
C)Private members
D)Pointers
E)None of these
A)Access specifiers
B)Static members
C)Private members
D)Pointers
E)None of these
Pointers
4
Arguments are passed to the base class destructor function by the ________ class ________ function.
A)derived, constructor
B)derived, destructor
C)base, constructor
D)base, destructor
E)None of these
A)derived, constructor
B)derived, destructor
C)base, constructor
D)base, destructor
E)None of these
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
5
The base class's ________ affects the way its members are inherited by the derived class.
A)name
B)return data type
C)access specification
D)A and B
E)None of these
A)name
B)return data type
C)access specification
D)A and B
E)None of these
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
6
________ members of a base class are never accessible to a derived class.
A)Public
B)Private
C)Protected
D)A, B, and C
E)None of these
A)Public
B)Private
C)Protected
D)A, B, and C
E)None of these
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
7
The ________ constructor is called before the ________ constructor.
A)base, derived
B)derived, base
C)public, private
D)private, public
E)None of these
A)base, derived
B)derived, base
C)public, private
D)private, public
E)None of these
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
8
When you derive a class from an existing class, you ________ add new data and functions.
A)never
B)must
C)may
D)None of these
A)never
B)must
C)may
D)None of these
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
9
Protected members of a base class are like ________, but they may be accessed by derived classes.
A)constructor functions
B)static members
C)private members
D)public members
E)None of these
A)constructor functions
B)static members
C)private members
D)public members
E)None of these
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
10
In an inheritance situation, the new class that you create from an existing class is known as the ________.
A)derived class
B)inheritor
C)child class
D)A and C
E)None of these
A)derived class
B)inheritor
C)child class
D)A and C
E)None of these
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
11
The term ________ means the ability to take many forms.
A)inheritance
B)polymorphism
C)member function
D)encapsulation
E)None of these
A)inheritance
B)polymorphism
C)member function
D)encapsulation
E)None of these
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
12
When a derived class has two or more base classes, the situation is known as ________.
A)multiple inheritance
B)polymorphism
C)encapsulation
D)access specification
E)None of these
A)multiple inheritance
B)polymorphism
C)encapsulation
D)access specification
E)None of these
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
13
The following statement: 
Allows the ________ members of the Car class to access ________ members of the Vehicle class.
A)private, private
B)public, private
C)protected, private
D)public, protected
E)None of these

Allows the ________ members of the Car class to access ________ members of the Vehicle class.
A)private, private
B)public, private
C)protected, private
D)public, protected
E)None of these
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
14
The compiler performs ________ on virtual functions.
A)static binding
B)dynamic binding
C)additional error checking
D)no special services
E)None of these
A)static binding
B)dynamic binding
C)additional error checking
D)no special services
E)None of these
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
15
When more than one class is derived from a base class, the situation is called:
A)polymorphism
B)population
C)multiplicity
D)encapsulation
E)None of these
A)polymorphism
B)population
C)multiplicity
D)encapsulation
E)None of these
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
16
The base class access specification determines how ________ members in the base class may be accessed by derived classes.
A)private
B)public
C)protected
D)A, B, and C
E)None of these
A)private
B)public
C)protected
D)A, B, and C
E)None of these
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
17
When the compiler binds a member function call with the version of the function that resides in the same class as the call itself, this is considered ________ binding.
A)local
B)safe
C)static
D)dynamic
E)None of these
A)local
B)safe
C)static
D)dynamic
E)None of these
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
18
A ________ of a base class expects to be overridden in a derived class.
A)constructor function
B)destructor function
C)static function
D)virtual function
E)None of these
A)constructor function
B)destructor function
C)static function
D)virtual function
E)None of these
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
19
________ allows us to create new classes based on existing classes.
A)Polymorphism
B)Inheritance
C)Function overloading
D)The copy constructor
E)None of these
A)Polymorphism
B)Inheritance
C)Function overloading
D)The copy constructor
E)None of these
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
20
In the following statement: class car : 
________ is the base class.
A)car
B)vehicle
C)public
D)class
E)None of these

________ is the base class.
A)car
B)vehicle
C)public
D)class
E)None of these
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
21
The base class access specification can be viewed as a filter that base class members must pass through when becoming inherited members of a derived class.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
22
In the following statement: 
What is being protected?
A)derived class functions
B)base class members
C)derived class data
D)future inherited classes
E)None of these

What is being protected?
A)derived class functions
B)base class members
C)derived class data
D)future inherited classes
E)None of these
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
23
When member functions behave differently, depending upon which object performed the call, this is an example of ________.
A)chaos theory
B)virtual insubordination
C)polymorphism
D)encapsulation
E)None of these
A)chaos theory
B)virtual insubordination
C)polymorphism
D)encapsulation
E)None of these
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
24
Static binding occurs when the compiler binds a function call with the function call that resides in the same class as the call itself.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
25
A derived class may not have any classes derived from it.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
26
C++ 11 introduces the ________ key word to help prevent subtle errors when overriding virtual functions.
A)const
B)final
C)override
D)virtual
E)None of these
A)const
B)final
C)override
D)virtual
E)None of these
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
27
More than one class may be derived from a base class.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
28
In the following statement: 
________ is the derived class.
A)Car
B)Vehicle
C)protected
D)Cannot be determined
E)None of these

________ is the derived class.
A)Car
B)Vehicle
C)protected
D)Cannot be determined
E)None of these
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
29
A virtual function is declared by placing the key word ________ in front of the return type in the base class's function declaration.
A)virtual
B)private
C)public
D)protected
E)None of these
A)virtual
B)private
C)public
D)protected
E)None of these
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
30
A derived class may become a base class, if another class is derived from it.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
31
Pointers to a base class may be assigned the address of a derived class object.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
32
________ is commonly used to extend a class, or to give it additional capabilities.
A)Inheritance
B)Privacy
C)The constructor
D)The destructor
E)None of these
A)Inheritance
B)Privacy
C)The constructor
D)The destructor
E)None of these
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
33
A member function of a derived class may not have the same name as a member function of a base class.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
34
________ functions are dynamically bound by the compiler.
A)Constructor
B)Destructor
C)Static
D)Virtual
E)None of these
A)Constructor
B)Destructor
C)Static
D)Virtual
E)None of these
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
35
Polymorphism is when ________ in a class hierarchy perform differently, depending upon which object performs the call.
A)base class constructors
B)derived class destructors
C)member functions
D)derived class constructors
E)None of these
A)base class constructors
B)derived class destructors
C)member functions
D)derived class constructors
E)None of these
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
36
A virtual function is a member function that expects to be ________ in a derived class.
A)ignored
B)called frequently
C)overridden
D)private
E)None of these
A)ignored
B)called frequently
C)overridden
D)private
E)None of these
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
37
In an inheritance situation, you may not pass arguments to a base class constructor.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
38
When arguments must be passed to the base class constructor, they are passed from the derived class constructor's header line.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
39
In C++ 11, if a derived class attempts to override a final member function, the compiler generates an error.
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck
40
Multiple inheritance is when a ________ class has ________ base classes.
A)base, no
B)derived, two or more
C)derived, no
D)compound, more than two
E)None of these
A)base, no
B)derived, two or more
C)derived, no
D)compound, more than two
E)None of these
Unlock Deck
Unlock for access to all 40 flashcards in this deck.
Unlock Deck
k this deck