Classes Questions and Answers

Take Exam

Python Programming - Classes Questions with Answers introduce learners to object-oriented principles like encapsulation and data modeling. These Python Classes Questions are key for Wipro, TCS, SSC, and RRB exams to understand how to create and use classes effectively

Classes

Showing 10 of 25 questions

11. What is the difference between class and instance variables?

  • No difference
  • Class variables are per instance, instance variables are shared
  • Class variables are shared, instance variables are per object
  • Both are the same
Show Answer Report

12. How do you create a static method in Python?

  • @staticmethod decorator
  • static keyword
  • def static()
  • Using static method
Show Answer Report

13. What is a class method in Python?

  • Method that only works with instances
  • Method that takes cls parameter and works with class
  • Method that cannot access class variables
  • Method that is private to class
Show Answer Report

14. What is the purpose of the __str__ method?

  • String conversion of object
  • Object destruction
  • Object comparison
  • Object creation
Show Answer Report

15. What is multiple inheritance in Python?

  • One class inheriting from one parent
  • One class inheriting from multiple parents
  • Multiple classes inheriting from one parent
  • No inheritance
Show Answer Report

16. What is an abstract class in Python?

  • Class that can be instantiated directly
  • Class with no methods
  • Class that cannot be instantiated and requires method implementation
  • Class with only variables
Show Answer Report

17. How do you create a property in Python?

  • Using property keyword
  • @property decorator
  • def property()
  • create_property()
Show Answer Report

18. What is method overloading in Python?

  • Creating multiple methods with same name but different parameters
  • Only one method per class
  • Method that overloads memory
  • Inheriting methods
Show Answer Report

19. What is the MRO (Method Resolution Order) in Python?

  • Method return order
  • Method resolution order for inheritance
  • Memory read order
  • Module load order
Show Answer Report

20. What is a destructor method in Python?

  • __init__
  • __del__
  • __destroy__
  • __cleanup__
Show Answer Report
Questions and Answers for Competitive Exams Various Entrance Test