Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1s2 = Student('Liam') | AUsing the class name changes the attribute on the class, not on one object. To change only one student use the object name, like s1.name = 'Zoe'. | |
| 2s1.name = 'Zoe' | Bs2 = s1 does not create a new object. It gives the same object a second name, so changing s2 also changes s1. Fix: s2 = Student('Liam'). | |
| 3Two objects from the same class can hold different data in their attributes | Cs1 = Student('Ava') s2 = Student('Liam') | |
| 4Objects from one class share the same methods but give different results because their data differs | DCreates a second object from the Student class with its own separate name value | |
| 5s1 = Student('Ava') s2 = s1 | EChanges the name of s1 only, so s2 keeps its old name | |
| 6Student.name = 'Zoe' | Fs1.greet() s2.greet() |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
s2 = Student('Liam') — Creates a second object from the same class. Each object keeps its own attribute values, so changing s2 does not change s1, but both use the same methods.s1 = Student('Ava')
s2 = Student('Liam')s1 = Student('Ava')
s2 = Student('Liam')
print(s2.name) # Liams1 = Student('Ava')
s2 = Student('Liam')
s2.points = 5 # s1 is unchangeds1.greet() # Hi, I am Ava
s2.greet() # Hi, I am Liamclass Student:
def __init__(self, name):
self.name = name