nerdexam
Python_Institute

PCPP-32-101 · Question #4

The following snippet represents one of the OOP pillars. Which one is that?

The correct answer is D. Polymorphism. The code snippet you provided demonstrates Polymorphism. This is because the 'run()' method is called on different objects (instances of classes A, B, and C), and each class defines its own version of the 'run()' method. This allows the same method call to behave differently…

Advanced OOP

Question

The following snippet represents one of the OOP pillars. Which one is that?

Exhibit

PCPP-32-101 question #4 exhibit

Options

  • ASerialization
  • BInheritance
  • CEncapsulation
  • DPolymorphism

How the community answered

(31 responses)
  • A
    6% (2)
  • C
    3% (1)
  • D
    90% (28)

Explanation

The code snippet you provided demonstrates Polymorphism. This is because the 'run()' method is called on different objects (instances of classes A, B, and C), and each class defines its own version of the 'run()' method. This allows the same method call to behave differently based on the object it is called on.

Topics

#polymorphism#OOP pillars#method overriding#duck typing

Community Discussion

No community discussion yet for this question.

Full PCPP-32-101 Practice