Object-Oriented Trace Flashcards

1
Q

What method initializes the object’s attributes when you create an object from a class?

A

__init__ method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

If p1 = Person(“Alice”), what does p1.name return?

A

“Alice”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What output does p1.greet() produce if it calls return f”Hello, my name is {self.name}!”?

A

“Hello, my name is Alice!”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly