🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Magic Methods and Properties: all 10 questions

Quiz: Magic Methods and Properties · Question 4 of 10

Without eq, what does a == b check for two objects of your class?

Without __eq__, what does a == b check for two objects of your class?

  1. A.Whether all attributes are equal
  2. B.Whether they have the same class
  3. C.Whether their str values match
  4. D.Whether they are the same object
Answer & explanation

Correct answer: Whether they are the same object

The default equality is identity.

Can you get the rest right without peeking?

Take the timed Quiz: Magic Methods and Properties quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →