Exam 15: Inheritance
Exam 1: Introduction to Computer and C Programming55 Questions
Exam 2: C++ Basics54 Questions
Exam 3: More Flow of Control44 Questions
Exam 4: Procedural Abstraction and Functions That Return a Value51 Questions
Exam 5: Functions for All Sub Tasks53 Questions
Exam 6: Io Streams As an Introduction to Objects and Classes51 Questions
Exam 7: Arrays34 Questions
Exam 8: Strings and Vectors63 Questions
Exam 9: Pointers and Dynamic Arrays40 Questions
Exam 10: Defining Classes50 Questions
Exam 11: Friends, overloaded Operators, and Arrays in Classes49 Questions
Exam 12: Separate Compilation and Namespaces38 Questions
Exam 13: Pointers and Linked Lists51 Questions
Exam 14: Recursion43 Questions
Exam 15: Inheritance53 Questions
Exam 16: Exception Handling47 Questions
Exam 17: Templates33 Questions
Exam 18: Standard Template Library57 Questions
Select questions type
If you have the following class definitions,which of the following is the proper way to construct an object of the derived class?
Class Pet
{
Public:
Pet);
Void printPet);
String getName);
Void setNamestring newName);
Private:
String name;
};
Class Dog:public Pet
{
Public:
Dog);
Void printPet);
Void setTypestring newType);
String getType);
Private:
String type;
};
(Multiple Choice)
4.9/5
(43)
An object of a derived class can be stored in a base class variable
(True/False)
4.7/5
(41)
If you use the keyword virtual in a function declaration,you must also use it in the function definition.
(True/False)
4.9/5
(32)
A base class may have at most _______ child class derived from it.
(Multiple Choice)
4.8/5
(43)
Which of the following should be virtual if a base class uses dynamic memory allocation?
(Multiple Choice)
4.7/5
(35)
When the derived class gets all the member variables from the base class,we say that they are _________ from the base class.
(Short Answer)
4.8/5
(37)
All member functions in a base class should be listed as virtual functions.
(True/False)
4.8/5
(41)
When we derive one class from another class,this is known as ____________
(Short Answer)
4.8/5
(38)
In the derived class definition,you list from the base class
(Multiple Choice)
4.9/5
(43)
Using virtual functions is also known as _______ the functions
(Short Answer)
4.8/5
(37)
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.8/5
(40)
Member functions defined as private in the base class are/are not)inherited in the derived class
(Short Answer)
4.8/5
(41)
Showing 21 - 40 of 53
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)