CS FundamentalsHardInfosys · TCS Digital

A UML class diagram shows Order with a filled (black) diamond connected to OrderLine with multiplicity 1..* on the OrderLine end. Which statement is correct?

  1. A. It is aggregation: OrderLines can exist and be shared without an Order
  2. B. It is generalisation: OrderLine is a kind of Order
  3. C. It is a dependency only
  4. D. It is composition: each OrderLine belongs to exactly one Order and is destroyed with it, and an Order has at least one line

Correct answer: D. It is composition: each OrderLine belongs to exactly one Order and is destroyed with it, and an Order has at least one line

A filled diamond means composition (strong ownership with a shared lifetime); a hollow diamond means aggregation. 1..* on the part end means every order has one or more lines.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic