Vidyalelo
C++ Programming · all questions

Polymorphism in C++
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

42

Questions

2/3

Page

Pick an option on a question to see the right answer and solution.

Which type of polymorphism allows a class to have multiple methods with the same name but different signatures?

Select an option to see the answer and solution.

What is the purpose of a virtual destructor in C++?

Select an option to see the answer and solution.

Which of the following is true about virtual functions in C++?

Select an option to see the answer and solution.

What is the syntax for calling a virtual function from a derived class constructor in C++?

Select an option to see the answer and solution.

What is the difference between static binding and dynamic binding in C++?

Select an option to see the answer and solution.

In C++, can a derived class have more than one base class with a virtual function?

Select an option to see the answer and solution.

Which type of polymorphism is achieved by function templates in C++?

Select an option to see the answer and solution.

What happens if a pure virtual function is not implemented in a derived class in C++?

Select an option to see the answer and solution.

Which C++ feature allows a function to behave differently based on the number or types of its arguments?

Select an option to see the answer and solution.

In C++, what is the effect of declaring a destructor as virtual?

Select an option to see the answer and solution.

Which type of polymorphism allows different classes to be treated as instances of the same class through a common interface?

Select an option to see the answer and solution.

How can you achieve runtime polymorphism in C++?

Select an option to see the answer and solution.

In C++, which keyword can be used to prevent a virtual function from being overridden in derived classes?

Select an option to see the answer and solution.

What is the main advantage of polymorphism in C++?

Select an option to see the answer and solution.

Which C++ keyword is used to access the base class within a derived class?

Select an option to see the answer and solution.

What is the difference between function overloading and function overriding in C++?

Select an option to see the answer and solution.

In C++, can you overload the return type of a function?

Select an option to see the answer and solution.

Which type of polymorphism is not supported in C++?

Select an option to see the answer and solution.

What is the primary reason for using virtual functions in C++?

Select an option to see the answer and solution.

How can you achieve polymorphism in C++?

Select an option to see the answer and solution.