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

Quiz: Inheritance, ABC and MRO · Question 9 of 10

A Library has many Books. Which design fits best?

A Library has many Books. Which design fits best?

  1. A.class Library(Book)
  2. B.class Book(Library)
  3. C.A Library object holding a list of Book objects (composition)
  4. D.Multiple inheritance from Library and Book
Answer & explanation

Correct answer: A Library object holding a list of Book objects (composition)

A library is not a book; it has books. That is a has-a relation.

Can you get the rest right without peeking?

Take the timed Quiz: Inheritance, ABC and MRO quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →