📢 Too many exams? Don’t know which one suits you best? Book Your Free Expert 👉 call Now!


    Question

    What is the purpose of the __init__() method in a class?

    A To define a class attribute Correct Answer Incorrect Answer
    B To define an instance attribute Correct Answer Incorrect Answer
    C To initialize an object when it is created Correct Answer Incorrect Answer
    D To define a class method Correct Answer Incorrect Answer
    E To define an instance method Correct Answer Incorrect Answer

    Solution

    Explanation: The __init__() method is a special method that is called when an object is created from a class. It is used to initialize the attributes of the object.

    Practice Next
    ask-question