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?
- A. It is aggregation: OrderLines can exist and be shared without an Order
- B. It is generalisation: OrderLine is a kind of Order
- C. It is a dependency only
- 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.
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- In an ATM use-case diagram, 'Withdraw Cash' always performs 'Authenticate User', while 'Print Receipt' happens only when the customer asks…
- In a UML sequence diagram, how are a synchronous call, an asynchronous message and a return message usually drawn?
- In a UML activity diagram, after an order is paid, 'Pack items' and 'Send invoice' happen in parallel, and 'Ship' may start only when both…
- A class diagram shows a dashed line with a hollow triangle from PaymentService to the interface IPayment, and a solid line with a hollow…
- Student and Course have a many-to-many association with an association class Enrollment holding the grade. If 30 students each enrol in 4…
- A change to how GST is calculated forces small edits in nine different classes across the code base. Which code smell is this, and how…