Which of the following is an example of compile-time polymorphism?

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
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
10 questions
DEBUG THE CODE

Quiz
•
University
15 questions
Exploring OOP: Polymorphism and Abstraction

Quiz
•
University
10 questions
java quiz on Encapsulation and Abstraction

Quiz
•
University
10 questions
104-P-01: Delegates and lambdas

Quiz
•
University
15 questions
Java Programming

Quiz
•
University
10 questions
Polymorphism in C++ Quiz

Quiz
•
University
10 questions
C Programming - Basics 001

Quiz
•
University
14 questions
Google Prof Cloud Archi - pt 11

Quiz
•
University
Popular Resources on Wayground
25 questions
Equations of Circles

Quiz
•
10th - 11th Grade
30 questions
Week 5 Memory Builder 1 (Multiplication and Division Facts)

Quiz
•
9th Grade
33 questions
Unit 3 Summative - Summer School: Immune System

Quiz
•
10th Grade
10 questions
Writing and Identifying Ratios Practice

Quiz
•
5th - 6th Grade
36 questions
Prime and Composite Numbers

Quiz
•
5th Grade
14 questions
Exterior and Interior angles of Polygons

Quiz
•
8th Grade
37 questions
Camp Re-cap Week 1 (no regression)

Quiz
•
9th - 12th Grade
46 questions
Biology Semester 1 Review

Quiz
•
10th Grade