Bird
Raised Fist0

Which of the following statements about composition and inheritance is INCORRECT?

medium🐞 Bug Identification Q14 of Q15
OOP & Design Patterns - Composition vs Inheritance - Favour Composition, Why & When
Which of the following statements about composition and inheritance is INCORRECT?
AComposition leads to tighter coupling between classes than inheritance.
BInheritance models 'is-a' relationships, while composition models 'has-a' relationships.
CFavoring composition improves flexibility and maintainability of code.
DInheritance can cause fragile base class problems when base classes change.
Step-by-Step Solution
  1. Step 1: Analyze each statement

    Options A, C, and D are correct statements. Composition leads to tighter coupling between classes than inheritance. is incorrect because composition reduces coupling by separating concerns, whereas inheritance creates tighter coupling due to dependency on base classes.
  2. Final Answer:

    Option A -> Option A
  3. Quick Check:

    Composition reduces coupling; inheritance increases it.
Quick Trick: Composition reduces coupling; inheritance increases coupling.
Common Mistakes:
MISTAKES
  • Confusing which relationship leads to tighter coupling
  • Assuming composition increases coupling
Trap Explanation:
PITFALL
  • Candidates often mistakenly believe composition increases coupling because of object references, but inheritance creates stronger compile-time dependencies.
Interviewer Note:
CONTEXT
  • Tests ability to spot misconceptions about coupling in composition vs inheritance.
Master "Composition vs Inheritance - Favour Composition, Why & When" in OOP & Design Patterns

2 interactive learning modes - each teaches the same concept differently

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More OOP & Design Patterns Quizzes