Search Header Logo

Polymorphism in C++

Authored by Purushotham M

Computers

11th - 12th Grade

Used 11+ times

Polymorphism in C++
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Media Image

What will be the output of this piece of code?

5500.263

500.2635

500.263

500.266

2.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Media Image

What will be the output of this piece of code?

print derived class

show base class

print derived class

show derived class

Error

3.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Which of the following is invalid prototype for function overloading

(A) void fun (int x); void fun (char ch) ;

(B) void fun (int x); void fun (int y);

(C) void fun (double d); void fun (char ch);

(D) void fun (double d); void fun (int y);

4.

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();

5.

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.

6.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Media Image

What is the output of the following code?

Base Display

Derived Display

Compilation Error

Runtime Error

7.

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.

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?