Bird
0
0

You have a function that calls the draw() method on any object passed to it, without checking the object's class. What programming principle does this illustrate?

hard📝 Application Q8 of 15
Python - Polymorphism and Dynamic Behavior
You have a function that calls the draw() method on any object passed to it, without checking the object's class. What programming principle does this illustrate?
AAbstraction
BEncapsulation
CInheritance
DPolymorphism
Step-by-Step Solution
Solution:
  1. Step 1: Understand the scenario

    The function calls draw() on any object, regardless of its class.
  2. Step 2: Identify the principle

    This is a classic example of polymorphism, where different objects respond to the same method call.
  3. Final Answer:

    Polymorphism -> Option D
  4. Quick Check:

    Method call works on multiple object types [OK]
Quick Trick: Call same method on different objects [OK]
Common Mistakes:
  • Confusing with encapsulation which hides data
  • Mistaking inheritance for method flexibility
  • Thinking abstraction is about method calls

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes