Bird
0
0

Which statement about constructors in Python is true?

easy📝 Conceptual Q2 of 15
Python - Constructors and Object Initialization
Which statement about constructors in Python is true?
AConstructors are used to delete object attributes
BConstructors can have any name you choose
CConstructors return values like normal functions
DConstructors are called automatically when an object is created
Step-by-Step Solution
Solution:
  1. Step 1: Recall constructor naming rules

    In Python, the constructor must be named __init__, not any other name.
  2. Step 2: Understand when constructors run

    Constructors run automatically when a new object is created, without needing to call them explicitly.
  3. Final Answer:

    Constructors are called automatically when an object is created -> Option D
  4. Quick Check:

    Constructor call timing = Automatic on object creation [OK]
Quick Trick: Constructor name is always __init__ [OK]
Common Mistakes:
  • Trying to name constructor differently
  • Expecting constructor to return a value
  • Using constructor to delete attributes

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes