Ch 15

29 August 2022
4.7 (114 reviews)
43 test answers

Unlock all answers in this set

Unlock answers (39)
question
In an inheritance situation, you may not pass arguments to a base class constructor.
answer
F
question
More than one class may be derived from a base class.
answer
T
question
A derived class may become a base class if another class is derived from it.
answer
T
question
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.
answer
T
question
When arguments must be passed to the base class constructor, they are passed from the derived class constructor's header line.
answer
T
question
A member function of a derived class may not have the same name as a member function of a base class.
answer
F
question
Static binding occurs when the compiler binds a function call with the function call that resides in the same class as the call itself.
answer
T
question
Pointers to a base class may be assigned the address of a derived class object.
answer
T
question
A derived class may not have any classes derived from it.
answer
F
question
In C++11, if a derived class attempts to override a final member function, the compiler generates an error.
answer
T
question
C++11 provides a way for a derived class to inherit some of the base class's constructors.
answer
T
question
In C++11, using constructor inheritance, it is possible for any of the base class's constructors to be inherited.
answer
F
question
In OOP programming, __________ allows you to create new classes based on existing classes. a. polymorphism b. inheritance c. function overloading d. the copy constructor e. None of these
answer
B
question
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
answer
C
question
The __________ members of a base class are never accessible to a derived class. a. private b. public c. protected d. All of these e. None of these
answer
A
question
The __________ constructor is called before the __________ constructor. a. base, derived b. derived, base c. public, private d. private, public e. None of these
answer
A
question
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
answer
D
question
The term __________ means the ability to take many forms. a. inheritance b. polymorphism c. member function d. encapsulation e. None of these
answer
B
question
When the compiler binds a member function call with the version of the function that resides in the same class as the call itself, it is considered a. local binding b. safe binding c. static binding d. dynamic binding e. None of these
answer
C
question
The compiler performs __________ on virtual functions. a. local binding b. additional error checking c. static binding d. dynamic binding e. None of these
answer
D
question
When more than one class is derived from a base class, the situation is called a. polymorphism b. multiplicity c. population d. encapsulation e. None of these
answer
E
question
When a derived class has two or more base classes, the situation is called a. multiple inheritance b. multiplicity c. polymorphism d. encapsulation e. None of these
answer
A
question
Multiple inheritance opens the opportunity for a derived class to have ___________ members. a. dynamic b. private c. public d. ambiguous e. None of these
answer
D
question
Which is the base class in the following statement? class Car : public Vehicle a. Car b. Vehicle c. public d. class e. None of these
answer
B
question
The following statement allows the __________ members of the Car class to access __________ members of the Vehicle class. class Car : public Vehicle a. private, private b. public, private c. protected, private d. public, protected e. None of these
answer
E
question
Which is the derived class in the following statement? class Car : protected Vehicle a. Car b. Vehicle c. protected d. There is no way to tell. e. None of these
answer
A
question
What is being protected in the following statement? class Car : protected Vehicle a. derived class functions b. base class members c. derived class data d. future inherited classes e. None of these
answer
B
question
Arguments are passed to the base class by the __________ class __________ function. a. derived, constructor b. derived, destructor c. base, constructor d. base, destructor e. None of these
answer
E
question
Arguments are passed to the base class destructor by the __________ class __________ function. a. derived, constructor b. derived, destructor c. base, constructor d. base, destructor e. None of these
answer
E
question
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
answer
C
question
The __________ destructor is called before the __________ destructor. a. base, derived b. derived, base c. public, private d. private, public e. None of these
answer
B
question
Which of the following 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
answer
A
question
When member functions behave differently depending on which object performed the call, this is an example of a. chaos theory b. virtual insubordination c. polymorphism d. encapsulation e. None of these
answer
C
question
A virtual function is a function that expects to be __________ in a derived class. a. ignored b. called frequently c. overridden d. private e. None of these
answer
C
question
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
answer
B
question
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
answer
A
question
Polymorphism is when __________ in a class hierarchy perform differently, depending on which object performs the call. a. base class constructors b. derived class constructors c. member functions d. derived class destructors e. None of these
answer
C
question
Functions that are dynamically bound by the compiler are __________ functions. a. constructor b. destructor c. static d. virtual e. None of these
answer
D
question
C++11 introduced the __________ key word to help prevent subtle errors when overriding virtual functions. a. const b. final c. override d. virtual e. None of these
answer
C
question
Select all that apply. 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. construction e. None of these
answer
C
question
Select all that apply. 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. parental class e. None of these
answer
A,C
question
Select all that apply. Which of the following constructors cannot be inherited through constructor inheritance? a. the default constructor b. the virtual constructor c. the move constructor d. the copy constructor e. the grand constructor
answer
A,C,D
question
Select all that apply. The base class access specification determines how __________ members in the base class may be accessed by derived classes. a. private b. public c. constructed d. protected e. None of these
answer
A,B,D