nerdexam
Python_Institute

PCPP-32-101 · Question #51

When are instance variables created? (Choose the best answer.)

The correct answer is A. During an object's initialization or later. Instance variables are typically created during object initialization (e.g., in __init__) but can also be added or modified later at any point in the object's lifecycle.

Advanced OOP

Question

When are instance variables created? (Choose the best answer.)

Options

  • ADuring an object's initialization or later.
  • BDuring an object's initialization only.
  • CAt any moment of the instance's life.
  • DUpon the first read access to the instance variable.

How the community answered

(34 responses)
  • A
    91% (31)
  • B
    3% (1)
  • C
    6% (2)

Explanation

Instance variables are typically created during object initialization (e.g., in init) but can also be added or modified later at any point in the object's lifecycle.

Topics

#instance variables#initialization#__init__#object lifecycle

Community Discussion

No community discussion yet for this question.

Full PCPP-32-101 Practice