
MCQs on Polymorphism in C++

Quiz
•
Computers
•
University
•
Hard
stuti Ahuja
Used 1+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is an example of compile-time polymorphism?
Function Overloading
Operator Overloading
Both A and B
None of the above
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code? class Base { public: virtual void display() { cout << "Base Display"; } }; class Derived : public Base { public: void display() { cout << "Derived Display"; } }; Base* b = new Derived(); b->display();
Base Display
Derived Display
Compilation Error
Runtime Error
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following statements about virtual functions is true?
They can be static.
They cannot be overridden.
They must be defined in the base class.
They are always inlined.
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What happens if a derived class does not override a virtual function?
The derived class will have a compilation error.
The base class function will be called.
The derived class will call its own function.
None of the above.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How do you declare a pure virtual function in C++?
virtual void func() = 0;
void func() = 0;
void func();
virtual void func();
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is a correct way to implement polymorphism?
Using function overloading.
Using operator overloading.
Using virtual functions.
All of the above.
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following best describes dynamic polymorphism?
It occurs at compile-time.
It is achieved through virtual functions and inheritance.
It is the same as function overloading.
None of the above.
Create a free account and access millions of resources
Similar Resources on Wayground
15 questions
TEST-1-PREP

Quiz
•
University
15 questions
OE- Introduction To Artificial Intelligence

Quiz
•
University
14 questions
AZ-900 Module 1

Quiz
•
1st Grade - Professio...
10 questions
Java Programming Pt. 1

Quiz
•
University
6 questions
Polymorphism

Quiz
•
University
15 questions
Week 09 - Mastering OOP Concepts in C++

Quiz
•
University
10 questions
OBJECT ORIENTED PROGRAMMING WITH JAVA

Quiz
•
University
15 questions
COA Q2

Quiz
•
University
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
20 questions
Definite and Indefinite Articles in Spanish (Avancemos)

Quiz
•
8th Grade - University
7 questions
Force and Motion

Interactive video
•
4th Grade - University
36 questions
Unit 5 Key Terms

Quiz
•
11th Grade - University
7 questions
Figurative Language: Idioms, Similes, and Metaphors

Interactive video
•
4th Grade - University
15 questions
Properties of Equality

Quiz
•
8th Grade - University
38 questions
WH - Unit 3 Exam Review*

Quiz
•
10th Grade - University
21 questions
Advise vs. Advice

Quiz
•
6th Grade - University
12 questions
Reading a ruler!

Quiz
•
9th Grade - University