Explore our extensive collection of questions and answers to enhance your learning experience and prepare for exams effectively
If not overridden, the parent method is used by default.
ABC from the abc module defines abstract base classes in Python.
Abstraction hides complex implementation, showing only the interface.
@abstractmethod from abc marks a method as abstract, requiring implementation.
Skipping an abstract method raises a TypeError at instantiation.
Duck typing enables polymorphism without inheritance by focusing on behavior.
super().method() calls the parent’s method, returning ‘Parent method’.
Polymorphism allows a function to handle different types with the same method name.
len() works polymorphically, returning 4 for ‘text’ and 3 for [1, 2, 3].
A class can have multiple methods with polymorphic behavior.