Python Polymorphism Questions and Answers

Practice Mode
Showing 10 of 25 questions
Q21
What is method chaining in Python?
  • A Creating a chain of classes
  • B Calling methods one after another on same object
  • C Linking methods from different objects
  • D Creating circular method calls
Answer: Option B
Explanation: Method chaining allows calling multiple methods sequentially on the same object.
Q22
Which concept is closely related to polymorphism?
  • A Encapsulation
  • B Inheritance
  • C Abstraction
  • D Composition
Answer: Option B
Explanation: Inheritance enables polymorphism by allowing subclasses to override methods from parent classes.
Q23
What is the purpose of the @classmethod decorator?
  • A To create static methods
  • B To create class-level methods
  • C To prevent method overriding
  • D To make methods private
Answer: Option B
Explanation: @classmethod defines a method that receives the class as the first argument instead of the instance.
Q24
Which method is used for object destruction?
  • A __destroy__
  • B __del__
  • C __remove__
  • D __delete__
Answer: Option B
Explanation: The __del__ method is called when an object is about to be destroyed.
Q25
What is multiple inheritance in Python?
  • A A class with multiple methods
  • B A class inheriting from multiple parents
  • C Multiple classes inheriting from one parent
  • D A class with multiple constructors
Answer: Option B
Explanation: Multiple inheritance allows a class to inherit from more than one parent class.
Questions and Answers for Competitive Exams Various Entrance Test