Question bank — UML — use case, class, sequence, activity, state machine, component diagrams
Part 0 — The glyph primer (see it before you're quizzed on it)
Every trap below hinges on a shape. Two of those shapes look almost identical — the hollow diamond ◇ is reused for aggregation (a class-diagram line-end) and for decision/merge (an activity-diagram node). They mean totally different things. So we draw each family separately.
Class-diagram relationship line-ends

Read the figure left to right, weakest "togetherness" to strongest:
- Association — a plain line ("knows about"). If the line has an open arrowhead on one end (a plain
>with no fill), that arrow is navigability: it says "this end can reach the other", not that a message is sent. A line with no arrowhead means either end can reach the other. - Aggregation — a hollow (unfilled) diamond ◇ on the whole's end; the part can live on its own.
- Composition — a filled (solid) diamond ◆ on the whole's end; the part dies with the whole.
- Inheritance — a hollow (unfilled) triangle ▷ pointing at the parent ("is-a").
Visibility symbols inside a class box

Every attribute and operation line starts with a visibility symbol saying who may access it:
+= public (anyone).-= private (only this class).#= protected (this class and its subclasses).~= package (anything in the same package).
Multiplicity (cardinality) at a line end

At each end of an association you may write multiplicity — how many objects can sit at that end:
1= exactly one (mandatory, and no more).0..1= zero or one (optional; at most one).*= zero or more, no upper bound.1..*= one or more, no upper bound.1..5= an explicit range: between one and five.
Use-case stereotype arrows (direction is the whole point)
<<include>>— a dashed arrow from the base use case to the included one. The base always pulls it in. (Withdraw → Authenticate.)<<extend>>— a dashed arrow from the extension to the base. The extension optionally reaches in. (Print Receipt → Withdraw.)
Activity-diagram control nodes (diamond vs bar)
- Decision — a hollow diamond ◇ with one incoming edge and several outgoing guarded
[condition]edges; exactly one branch is taken. - Merge — the same diamond shape, but used the other way: several incoming edges and one outgoing edge. It brings alternative paths back together and does not wait for anything.
- Fork — a thick bar ━ with one incoming edge and several outgoing edges that run all at once.
- Join — a thick bar ━ with several incoming edges and one outgoing edge that waits for every parallel flow before continuing.
Sequence-diagram anatomy and fragments
- Lifeline — dashed vertical line = the object exists.
- Activation bar — thin rectangle on the lifeline = the object is running a method right now.
- Synchronous message (solid line, filled solid arrowhead ▶) = caller waits for a reply.
- Return (dashed line, open arrowhead) = the reply coming back.
- Asynchronous message (solid line, open thin arrowhead ⇀, the two half-lines of a
>) = caller does not wait; it fires the message and carries on immediately. - Fragments boxed with a corner label:
alt(if/else),opt(runs zero-or-once),loop(repeats).
State-machine transition label
A transition arrow carries up to three parts: event [guard] / action.
- event — the trigger that fires the arrow.
- [guard] — a condition that must be true, or the arrow doesn't fire.
- /action — what happens as it fires.
Recall Quick glyph check before the quiz
Hollow diamond on a class line ::: aggregation (part survives).
Filled diamond on a class line ::: composition (part dies with whole).
Open arrowhead on a class association ::: navigability (which end knows the other), not a message.
+ - # ~ before a class member ::: public, private, protected, package visibility.
1, 0..1, *, 1..* at a line end ::: exactly one, optional, zero-or-more, one-or-more (star = unbounded).
Thick bar in an activity flow ::: fork (one-in many-out) or join (many-in one-out, waits).
Diamond in an activity flow, one-in many-out ::: decision (choose one, guarded).
Diamond in an activity flow, many-in one-out ::: merge (rejoin alternatives, no wait).
Filled arrowhead in a sequence diagram ::: synchronous (wait); open arrowhead ::: asynchronous (don't wait) or a return.
Dashed arrow base→sub ::: <<include>>; dashed arrow extension→base ::: <<extend>>.
True or false — justify
An <<include>> and an <<extend>> are the same relationship drawn with opposite arrows, so you can swap them freely
<<include>> (base→sub) means the base always runs it; <<extend>> (extension→base) means it runs only under a condition. The meaning, not just the arrow, changes.A class diagram is a behavioural diagram because classes "do things" via their methods
Composition (◆) and aggregation (◇) are both "has-a", so choosing between them is just style
In a sequence diagram, the vertical dashed lifeline shows the exact time the object is executing code
A fork (━) and a decision (◇) both split one path into many, so either shape works for branching
An actor in a use case diagram must be a human being
A state machine diagram and an activity diagram are interchangeable because both use arrows between shapes
Two actors connected to the same use case means the system runs that use case twice
Multiplicity 1..* on a class-diagram line means "somewhere between one and a few"
* means many with no upper bound; 1..* reads "one or more, unbounded above". If you meant a cap you'd write an explicit number like 1..5.A synchronous message and an asynchronous message differ only in arrowhead shape
An open arrowhead on a class-diagram association means a message flows in that direction
Spot the error
"I drew Withdraw Cash <<include>> Print Receipt because withdrawing usually prints a receipt."
<<extend>> from Print Receipt to Withdraw Cash — <<include>> would force a receipt on every withdrawal."My class box shows House ◆—— Room but I let a Room belong to two Houses at once."
"In my sequence diagram I put a loop fragment but I want the loop body to run only when balance is low."
loop fragment means "repeat"; a condition that may run once or not at all is opt (optional), and a two-way if/else is alt (all three shown in figure s04). loop is the wrong fragment for a single guarded check."I used a decision node (◇) to pack items and charge the card at the same time."
"My turnstile transition is labelled just unlock with no event."
unlock is an action (the /action part, see figure s05). The correct label is coin / unlock — event first, action after the slash."I merged two parallel flows back together using a merge node (◇)."
"On my class box I marked a private field with +."
+ means public (figure s06). Private is -; you also have # protected and ~ package. The visibility symbol carries real access meaning, so the wrong glyph mis-documents the design.Why questions
Why does UML split diagrams into structural and behavioural families instead of one universal diagram?
Why factor Authenticate out with <<include>> instead of copying it into every use case?
Why does a sequence diagram put objects across the top and time down the side, rather than showing workflow like an activity diagram?
Why does an activity diagram's join make the flow wait rather than just merge?
Why label a state-machine transition event [guard] / action with three parts?
Why is a use case diagram deliberately free of implementation detail?
Edge cases
What does a self-transition on a Locked state (event push, staying Locked) actually model?
An object exists in a scenario but never sends or receives a message — what appears in the sequence diagram?
A use case has an actor associated but no <<include>> or <<extend>> links — is the diagram incomplete?
In a state machine, can one object be in two states at once?
What does multiplicity 0..1 at a line end express, and when is it different from 1?
0..1 means the link is optional — zero or one — whereas 1 means it is mandatory — exactly one must exist (figure s07). The difference matters at object creation: a 1 end must be filled, a 0..1 end may be empty.If you delete the whole in an aggregation (Library ◇— Book), what happens to the parts?
Recall One-line rule that resolves most of these traps
Ask the diagram's question first: who/what (use case), what-exists (class), what-order (sequence), how-flows (activity), which-states (state machine). The right shape and semantics follow from the question, not the other way around.