What is polymorphism?

202320232023

What is polymorphism?

  1. A.

    Ability to take more than one form

  2. B.

    Ability to encapsulate data

  3. C.

    Ability to inherit methods

  4. D.

    Ability to create abstract classes

Attempted by 3 students.

Show answer & explanation

Correct answer: A

Concept: Polymorphism (poly = many, morph = form) is the OOP principle that lets the SAME interface or method call produce different behavior depending on the actual (runtime) type of the object invoking it — one operation, many forms.

Application: Applying this definition to the options given, “the ability to take more than one form” is exactly this many-forms behavior, so it correctly identifies polymorphism.

Why the others don’t fit:

  • “Ability to encapsulate data” describes encapsulation — bundling data with the methods that operate on it and restricting direct access — a data-hiding idea, not behavior varying by type.

  • “Ability to inherit methods” describes inheritance — reusing or extending a parent class’s members in a child class — a code-reuse relationship, not multiple forms of the same call.

  • “Ability to create abstract classes” describes abstraction — defining a template/contract without full implementation — a design-hiding idea, not many-forms behavior.

Explore the full course: Hexaware Preparation