Questions: Objects and Instances

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

Consider this code: dog1 = Dog('Rex', 5); dog2 = Dog('Luna', 3); dog1.age = 10. After these three lines run, what is dog2.age?

A10, because dog1 and dog2 are instances of the same class and share attribute values
B3, because each instance maintains its own independent copy of its instance attributes
CNone, because the age attribute was modified and no longer has a valid value
D5, because dog2 was created before dog1's age was changed
Question 2 Multiple Choice

A student writes 'dog1.__init__("Rex", 5)' to manually set up a dog object's attributes after creating it. Why is this the wrong approach?

ABecause __init__ does not accept arguments in Python
BBecause __init__ is called automatically when you instantiate the class — calling it explicitly would run initialization twice and bypasses the intended creation pattern
CBecause constructors can only be invoked by the Python interpreter, never directly by user code
DBecause you must use the Dog() syntax and cannot call __init__ with dot notation
Question 3 True / False

All instances of the same class share the class's method definitions, but each instance has its own independent copy of its instance attributes.

TTrue
FFalse
Question 4 True / False

When you call a method on an object (e.g., my_dog.bark()), Python stores a separate copy of the bark method in the instance's memory for each invocation.

TTrue
FFalse
Question 5 Short Answer

What is the difference between a class and an instance, and why does this distinction matter when you modify an attribute on one instance?

Think about your answer, then reveal below.