Python Polymorphism Questions and Answers

Take Exam

Python Programming - Polymorphism Questions with Answers help learners understand how objects share methods in object-oriented programming. These Python Polymorphism Questions are vital for TCS, Infosys, Wipro, and SSC exams, making it easier to master function overloading and overriding concepts in Python

Python Polymorphism

Showing 10 of 25 questions

11. What is compile-time polymorphism?

  • Method overriding
  • Method overloading
  • Operator overloading
  • Duck typing
Show Answer Report

12. Which of the following is true about polymorphism in Python?

  • It requires explicit type declaration
  • It is achieved through inheritance
  • It only works with built-in types
  • It prevents code reuse
Show Answer Report

13. What is the purpose of the super() function in method overriding?

  • To create superclass objects
  • To call parent class methods
  • To make methods faster
  • To prevent method overriding
Show Answer Report

14. Which operator overloading method is used for comparison?

  • __compare__
  • __eq__
  • __same__
  • __check__
Show Answer Report

15. What is abstract base class (ABC) in Python?

  • A class with no methods
  • A class that cannot be inherited
  • A class with abstract methods
  • A class with only static methods
Show Answer Report

16. Which module is used for abstract base classes?

  • abstract
  • abc
  • base
  • abstractbase
Show Answer Report

17. What is the difference between __str__ and __repr__?

  • No difference, they are the same
  • __str__ is for users, __repr__ is for developers
  • __str__ is faster than __repr__
  • __repr__ is only for numbers
Show Answer Report

18. Which decorator is used to define abstract methods?

  • @abstract
  • @abstractmethod
  • @abstract_class
  • @must_override
Show Answer Report

19. What is operator overloading?

  • Changing operator symbols
  • Giving special meaning to operators
  • Creating new operators
  • Removing operators from language
Show Answer Report

20. Which method is called when an object is created?

  • __new__
  • __init__
  • __create__
  • __start__
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test