Bird
0
0

Which statement about Python classes and objects is TRUE?

hard📝 Conceptual Q10 of 15
Python - Object-Oriented Programming Foundations
Which statement about Python classes and objects is TRUE?
AEach object has its own copy of instance variables
BClass variables are unique to each object
CMethods cannot access instance variables
DThe __init__ method is optional and never called
Step-by-Step Solution
Solution:
  1. Step 1: Understand instance variables

    Instance variables belong to each object separately, so each object has its own copy.
  2. Step 2: Check other options for correctness

    Class variables are shared, methods can access instance variables, and __init__ is called automatically when creating objects.
  3. Final Answer:

    Each object has its own copy of instance variables -> Option A
  4. Quick Check:

    Instance variables are per object [OK]
Quick Trick: Instance variables belong to each object separately [OK]
Common Mistakes:
  • Confusing class and instance variables
  • Thinking methods can't access instance variables
  • Believing __init__ is never called

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes