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

Quiz: Inheritance · Question 5 of 10

"A Car has an Engine" is modelled best with:

"A Car has an Engine" is modelled best with:

  1. A.Inheritance (Car extends Engine)
  2. B.Composition (Car holds an Engine object)
  3. C.Polymorphism
  4. D.An interface only
Answer & explanation

Correct answer: Composition (Car holds an Engine object)

It's a has-a relationship, so composition fits.

Can you get the rest right without peeking?

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

Start the quiz →