wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

OOP - Polymorphism in Python

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What does the word polymorphism literally mean in Greek?

a)

One shape

b)

Many forms

c)

Single type

d)

Multiple loops

2.

In the given Python example, what is the name of the method used in all four classes?

a)

calculate()

b)

run()

c)

operate()

d)

execute()

3.

Which type of polymorphism is demonstrated in the code snippet?

a)

Compile-time polymorphism

b)

Runtime polymorphism

c)

Static method overloading

d)

Function overloading

4.

In the Divide class, what does the code do when b equals zero?

a)

Returns infinity

b)

Prints None

c)

Prints an error message

d)

Skips the operation silently

5.

Why is polymorphism useful in the given code?

a)

It removes the need for loops

b)

It allows the same method name to have different implementations

c)

It automatically converts numbers to strings

d)

It speeds up execution time

6.

How does the for loop in the snippet demonstrate polymorphism?

a)

It checks each object’s class before calling its method

b)

It calls operate() without caring about the object type

c)

It executes only the Add class method

d)

It prevents division by zero

7.

What OOP principles are strongly supported by polymorphism in this example?

a)

Recursion and Iteration

b)

Abstraction and Encapsulation

c)

Inheritance and Compilation

d)

Casting and Parsing

8.

Which of the following is NOT a benefit of using polymorphism?

a)

Easier code extension

b)

Improved maintainability

c)

Reduced type-checking conditions

d)

Increased number of if statements

9.

In the analogy given, polymorphism is compared to:

a)

A Swiss army knife

b)

A universal remote

c)

A toolbox

d)

A smartphone

10.

If we wanted to add a new operation, such as exponentiation, what should we do according to polymorphism principles?

a)

Modify all existing classes

b)

Create a new class with the operate() method

c)

Add a case statement in the loop

d)

Replace the for loop with multiple if statements