Exam 15: Polymorphism and Virtual Functions
Exam 1: C++ Basics37 Questions
Exam 2: Flow of Control33 Questions
Exam 3: Function Basics30 Questions
Exam 4: Parameters and Overloading31 Questions
Exam 5: Arrays32 Questions
Exam 6: Structures and Classes37 Questions
Exam 7: Constructors and Other Tools32 Questions
Exam 8: Operator Overloading,friends,and References31 Questions
Exam 9: Strings37 Questions
Exam 10: Pointers and Dynamic Arrays29 Questions
Exam 11: Separate Compilation and Namespaces35 Questions
Exam 12: Streams and File IO43 Questions
Exam 13: Recursion40 Questions
Exam 14: Inheritance30 Questions
Exam 15: Polymorphism and Virtual Functions34 Questions
Exam 16: Templates27 Questions
Exam 17: Linked Data Structures30 Questions
Exam 18: Exception Handling29 Questions
Exam 19: Standard Template Library46 Questions
Exam 20: Patterns and Uml22 Questions
Select questions type
If the override specifier is added to the end of a member function declaration,what happens if the function is not specified as virtual in the parent class?
(Multiple Choice)
4.8/5
(35)
The virtual function mechanism binds the "right" function to objects.
(True/False)
4.8/5
(44)
It is useful to define a class for which no objects may be defined.
(True/False)
4.9/5
(43)
Why do you not get an undefined reference in virtual table error when you don't define a pure virtual function?
(Essay)
4.7/5
(43)
Explain the difference between virtual functions,late binding,and polymorphism.
(Essay)
4.9/5
(31)
Is there an error?
class B
{
public:
void virtual f();
};
void B::f(){/*...*/}
(Essay)
4.9/5
(30)
This is legal code.
class B
{
public:
// ...
virtual void f()= 0;
};
int main(){ B b1,b2;/*...*/ }
(True/False)
4.7/5
(38)
In C++,a virtual destructor is invoked whenever a virtual constructor was used to create the object.
(True/False)
4.8/5
(37)
Give some simple recommendation for when a destructor should be declared virtual.
(Essay)
4.8/5
(32)
What is the error?
class B
{
public:
virtual void f();
};
virtual void B::f(){/*...*/}
(Essay)
4.8/5
(31)
In a class,functions declared with the virtual keyword need not be defined.
(True/False)
4.8/5
(38)
Showing 21 - 34 of 34
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)