Exam 15: Inheritance
Exam 1: Introduction to Computer and C++ Programming56 Questions
Exam 2: C++ Basics57 Questions
Exam 3: More Flow of Control45 Questions
Exam 4: Procedural Abstraction and Functions That Return a Value53 Questions
Exam 5: Functions for All Sub Tasks54 Questions
Exam 6: Io Streams As an Introduction to Objects and Classes52 Questions
Exam 7: Arrays48 Questions
Exam 8: Strings and Vectors69 Questions
Exam 9: Pointers and Dynamic Arrays39 Questions
Exam 10: Defining Classes61 Questions
Exam 11: Friends, Overloaded Operators, and Arrays in Classes56 Questions
Exam 12: Separate Compilation and Namespaces41 Questions
Exam 13: Pointers and Linked Lists64 Questions
Exam 14: Recursion48 Questions
Exam 15: Inheritance53 Questions
Exam 16: Exception Handling47 Questions
Exam 17: Templates35 Questions
Exam 18: Standard Template Library59 Questions
Select questions type
When we derive one class from another class, this is known as ____________
Free
(Short Answer)
4.8/5
(31)
Correct Answer:
inheritance
If a base class has a public member function, and the derived class has a member function with the same name, but with a different parameter list, this function is said to be
Free
(Multiple Choice)
4.9/5
(36)
Correct Answer:
A
Member functions defined as private in the base class are/are not) inherited in the derived class
Free
(Short Answer)
4.8/5
(35)
Correct Answer:
are not
Given a class A that derives from a class B that derives from a class C, when an object of class A goes out of scope, in which order are the destructors called?
(Multiple Choice)
4.9/5
(35)
A base class may have at most _______ child class derived from it.
(Multiple Choice)
4.8/5
(28)
If a derived class Class2) has redefined a function from the base class Class 1), how can that derived function call the base class function if the function declaration is as follows?
Void print );
(Multiple Choice)
4.9/5
(41)
If the member variables of the base class are marked as protected, who can access those variables?
(Essay)
4.8/5
(36)
Given the following classes and code, what is the output of the last statement shown?
Class Pet
{
Public:
Virtual void print);
String name;
Private:
};
Class Dog: public Pet
{
Public:
Void print);
String breed;
};
Void Pet::print)
{
Cout << "My name is " << name;
}
Void Dog::print)
{
Pet::print);
Cout << ", and my breed is a "<< breed << endl;
}
Pet* pPtr;
Dog* dPtr=new Dog;
DPtr->name= "Rover";
DPtr->breed="Weiner";
PPtr= dPtr;
PPtr->print);
(Multiple Choice)
4.9/5
(42)
The ability to associate multiple meanings to one function name using dynamic binding is called _________.
(Short Answer)
4.8/5
(45)
If you use the keyword virtual in a function declaration, you must also use it in the function definition.
(True/False)
4.9/5
(41)
The base class has everything that is in the derived class and more
(True/False)
4.9/5
(31)
In the derived class definition, you list from the base class
(Multiple Choice)
4.8/5
(45)
If you have a copy constructor in the base class, but do not have a copy constructor for the derived class, then
(Multiple Choice)
4.9/5
(33)
Using virtual functions is also known as _______ the functions
(Short Answer)
4.8/5
(37)
Which of the following should be virtual if a base class uses dynamic memory allocation?
(Multiple Choice)
4.9/5
(31)
If a base class has a non-virtual member function named print, and a pointer variable of that class is pointing to a derived object, then the code ptr->print ); calls
(Multiple Choice)
4.8/5
(43)
Showing 1 - 20 of 53
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)