MCQs on Polymorphism in C++

MCQs on Polymorphism in C++

University

10 Qs

quiz-placeholder

Similar activities

Virtual Reality/Technology

Virtual Reality/Technology

9th Grade - University

10 Qs

ITP  Quiz

ITP Quiz

University

10 Qs

C++ operator overloading

C++ operator overloading

University

10 Qs

Polymorphism in C++ Quiz

Polymorphism in C++ Quiz

University

10 Qs

C Programming - Basics 001

C Programming - Basics 001

University

10 Qs

Google Prof Cloud Archi - pt 11

Google Prof Cloud Archi - pt 11

University

14 Qs

Session 2 | U

Session 2 | U

University

10 Qs

Object Oriented Programming Quizizz

Object Oriented Programming Quizizz

10th Grade - University

11 Qs

MCQs on Polymorphism in C++

MCQs on Polymorphism in C++

Assessment

Quiz

Computers

University

Hard

Created by

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

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?