LearnFrenzy
Sign in Take a free test

OOP in Python · OOP in Python MCQ · Question 2

The role of __init__ Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 2 Back to Exercise

When does __init__ run?

  • A When the class is defined
  • B Automatically when a new object of the class is created Correct
  • C When the object is deleted
  • D Only when called explicitly
Correct Answer: Option B

Student("Asha") creates the object and then calls __init__ on it.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links