Python Polymorphism Questions and Answers
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
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
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
14. Which operator overloading method is used for comparison?
- __compare__
- __eq__
- __same__
- __check__
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
16. Which module is used for abstract base classes?
- abstract
- abc
- base
- abstractbase
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
18. Which decorator is used to define abstract methods?
- @abstract
- @abstractmethod
- @abstract_class
- @must_override
19. What is operator overloading?
- Changing operator symbols
- Giving special meaning to operators
- Creating new operators
- Removing operators from language
20. Which method is called when an object is created?
- __new__
- __init__
- __create__
- __start__