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

Quiz: Composition vs Inheritance · Question 6 of 10

Which is a good use of inheritance?

Which is a good use of inheritance?

  1. A.Car extends Engine to reuse the start() method
  2. B.InvalidMarksException extends RuntimeException
  3. C.Stack extends Vector to reuse storage
  4. D.Student extends ArrayList to store subjects
Answer & explanation

Correct answer: InvalidMarksException extends RuntimeException

An exception genuinely is a RuntimeException; the others only want to reuse code.

Can you get the rest right without peeking?

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

Start the quiz →