Software Engineering › How to answer › Drawing › a class diagram
How to draw a class diagram
The class diagram is the drawing question the NESA papers have actually asked in 2025. Learn inheritance first: move shared attributes up to a parent class. From NESA material
What it looks like in the real exam
From NESA material 2025 HSC 2025 HSC exam, Q22 (3 marks): “Construct a class diagram that shows inheritance and removes redundant attributes for each class. Additional classes may be included if required. You do NOT need to show the nature of the relationships between the classes.” (The list of animal classes was an image.) 2025 sample 2025 NESA sample exam, Q24 (4 marks): a train company class diagram with classes, attributes, methods, inheritance, relationships and multiplicity.
2025 HSC exam, Q22 · 3 marks
Official marking criteria
- 3 marks: Correct class diagram that shows inheritance and removes redundant attributes from each class.
- 2 marks: Some understanding of the problem.
- 1 mark: Some relevant information.
Notes
Open this question page · some of the NESA wording or answer is an image or is unpublished, as noted
2025 NESA sample exam, Q24 · 4 marks
Official marking criteria
- 4 marks: Substantially correct class diagram with suitable classes, attributes and methods, showing inheritance, relationships and multiplicity.
- 3 marks: Represents most features.
- 2 marks: Some features.
- 1 mark: Some understanding of the scenario.
Notes
Open this question page · some of the NESA wording or answer is an image or is unpublished, as noted
From course notes Course grid: Class diagram is worth about 4 marks in the school’s exam-style grid (target band 5–6).
The notation
| Item | How to draw it |
|---|---|
| Class | A rectangle in three parts: name (top), attributes (middle), methods (bottom) |
| Inheritance | An arrow from the subclass to the superclass (hollow triangle head pointing at the parent) |
| Association | A line between classes, optionally labelled with a verb (“studies”) |
| Multiplicity | Numbers at the ends of a line: 1, 0..* (zero or more), 1..* (one or more) |
From NESA material Specification wording: “Inheritance is shown by an arrow from the subclass to the superclass. Multiplicity (1, 0..*, 1..*) shows how many objects can be related: a student studies 1 or more subjects; a subject has 0 or more students.” Reasoned The hollow triangle head is the standard UML convention; the specification text only says “arrow”.
Method (removing redundant attributes)
- List every class and its attributes from the question (write them on scrap paper). From course notes
- Find the attributes that appear in several classes (for example every animal has a name and a habitat). From course notes Technique note from our question bank (not from the NESA marking guideline): move attributes shared by several classes up into a parent.
- Create a parent class (a new additional class is allowed: “Additional classes may be included if required”) and put the shared attributes there once. From NESA material
- Leave only the unique attributes in each subclass. If a group of subclasses shares more, add a middle class. From NESA material Marker feedback: “refine attributes into separate inherited classes”.
- Draw an inheritance arrow from each subclass up to its parent. From course notes
- Add methods, relationships and multiplicity if the question asks for them (sample Q24 does; Q22 says you do not need relationship types). From NESA material
- Check that no attribute is repeated in a parent and a child.
Worked example: Person, Student and Teacher (original)
Original practice Before refining, Student and Teacher each had name and email. After: name and email are written once in Person, and each subclass keeps only its own (studentID, staffID). The arrows from Student and Teacher point at Person. “studies” with 0..* and 1..* shows the multiplicity between Student and Subject.
Original practice A second original example: Animal classes Dog, Cat and Bird, each listed with name, age and habitat. Refined answer: a parent Animal (name, age, habitat); subclasses Dog (breed), Cat (indoor), Bird (wingspan), each with an arrow to Animal.
The 4-mark class diagram: the train company (sample Q24)
From NESA material The bank records only a reasoned design for this question (not NESA’s diagram, which is an image): classes Trip (tripID; assignTicket()), PassengerCar (carModelCode), Engine (engineModelCode), Area (areaType, numSeats) with subclasses Executive (20 seats) and Standard (400 seats), Passenger (email, phone; buyTicket()) with subclass FrequentTraveller, and Ticket (ticketType, seatNumber). Relationships include a Trip with many Passengers. Reasoned Use it as a model of the kind of answer, not as the official one.
Markers’ checklist
- Each class is a three-part box with a name (and attributes/methods when asked).
- Shared attributes appear once, in a parent class.
- Each subclass has an arrow to its parent (arrow direction: child → parent).
- Subclasses show only their own attributes.
- Multiplicity numbers are on the correct ends if asked.
- Every class in the question appears (extra parent classes are allowed).
- Class names are singular nouns, with a capital letter.
Common mistakes
- From NESA material 2025 feedback: attributes not refined into separate inherited classes; inappropriate symbols.
- General advice Arrow drawn from parent to child.
- General advice Repeating the same attribute in the parent and the child.
- General advice Putting multiplicity at the wrong end of the line.
- General advice Forgetting the methods in a 4-mark question that asks for “attributes and methods”.
Time per mark
Derived The paper averages 1.75 minutes per mark (140 minutes ÷ 80 marks), so a 3-mark drawing question is about 5.3 minutes in total. General advice Suggested split: 1 minute reading and planning, most of the time drawing, and the last minute checking labels against the checklist. Drawing in an online tool is slower than on paper, so practise with the tool on NESA’s familiarisation site.
Reasoned The 4-mark sample Q24 is about 7 minutes.
Practice (3 prompts, with answers)
Item 1 · vehicles
Classes: Car (registration, make, doors), Truck (registration, make, loadLimit), Motorbike (registration, make, hasSidecar). Draw a refined class diagram showing inheritance.
Show the answer
Model answer: new parent Vehicle (registration, make); subclasses Car (doors), Truck (loadLimit), Motorbike (hasSidecar); an inheritance arrow from each subclass to Vehicle. Original practice
Item 2 · multiplicity
A Library has many Books; each Book belongs to exactly one Library. Show the multiplicity.
Show the answer
Model answer: a line between Library and Book with 1 at the Library end and 0..* (or 1..*) at the Book end. Original practice
Item 3 · fix the diagram
A student’s diagram has Dog → Animal drawn with the arrow pointing at Dog, and “name” listed in both Dog and Animal. List the two faults.
Show the answer
(1) The inheritance arrow must point from the subclass (Dog) to the superclass (Animal). (2) “name” is redundant in Dog: it is inherited, so remove it from Dog. Original practice
Terms, flashcards and past questions
Key terms for this page: Class diagram · Class diagram inheritance and multiplicity · Inheritance · Superclass and subclass · Python classes and objects
Flashcards · All key terms · Learn step by step · All past questions · Multiple-choice bank · Mock exam
Past questions used on this page:
← How to draw and read a structure chartHow to draw and simplify a decision tree →