Software Engineering › Notes › Pseudocode, flowcharts and diagram rules
Pseudocode, flowcharts and diagram rules
Pseudocode rules
- Keywords in capitals: IF, ELSE, WHILE, FOR, REPEAT, BEGIN, END, RETURN.
- Paired structure: For every BEGIN there is an END; for every IF there is an ENDIF; WHILE has ENDWHILE; FOR has NEXT; CASEWHERE has END CASE.
- Indentation: Indent the body of every control structure so the structure is clear.
- Subroutines by name: Refer to a subroutine by name in the mainline and show its logic in a separate algorithm with the same name (refinement).
- Mainline: Start complex algorithms with a clear, uncluttered mainline that calls subroutines. Each subroutine is concise.
- Subroutine, module, subprogram, procedure: Interchangeable terms. A function is a subroutine that returns a single value with RETURN.
- Sequence, selection, repetition: The three basic control structures. Algorithms are combinations of them.
Control structures in HSC pseudocode
- Binary selection:
IF condition THEN
process 1
ELSE
process 2
ENDIF
- Multi-way selection (case):
CASEWHERE expression evaluates to
choice a: process a
choice b: process b
OTHERWISE: default process
END CASE
- Nested IF:
IF condition A THEN
process 1
ELSE
IF condition B THEN
process 2
ELSE
process 3
ENDIF
ENDIF
- Pre-test loop:
WHILE condition is true
process
ENDWHILE
- Post-test loop:
REPEAT
process
UNTIL condition is true
- Counted loop:
FOR variable = start TO finish STEP increment
statements
NEXT variable
- Pre-test v post-test: Pre-test (WHILE) checks first, so the body may run zero times. Post-test (REPEAT...UNTIL) runs the body at least once and loops until the condition becomes true.
- Subroutine with parameters:
BEGIN AddNumbers
FOR i = 1 TO 5
Add (i, i + 1, sum)
Display sum
NEXT i
END AddNumbers
BEGIN Add (x, y, total)
total = x + y
END Add (x, y, total)
- Function with RETURN:
BEGIN Add (x, y)
total = x + y
RETURN total
END Add (x, y)
Worked pseudocode: RiskRating (2025 Q17 style)
- Task: Sum 10 array scores: more than 35 = High, less than 20 = Low, otherwise Medium. (Original pseudocode in HSC style, matches the 2025 MG requirements.)
BEGIN RiskRating
SET total = 0
FOR i = 1 TO 10
total = total + scores[i]
NEXT i
IF total > 35 THEN
rating = "High"
ELSE
IF total < 20 THEN
rating = "Low"
ELSE
rating = "Medium"
ENDIF
ENDIF
Display rating
END RiskRating
- Marking tips (3 marks): Loop through all 10 items; accumulate correctly; correct conditions with the right boundaries (35 and 20 themselves are Medium); display or return the result.
- Other standard algorithms:
BEGIN FindLargest
largest = list[1]
FOR i = 2 TO length
IF list[i] > largest THEN
largest = list[i]
ENDIF
NEXT i
Display largest
END FindLargest
Flowchart rules
- Direction: Read top to bottom and left to right, with arrowheads on the lines.
- Terminator: Rounded shape marking Start and End.
- Process: Rectangle for a step or calculation.
- Input/output: Parallelogram for reading input or displaying output.
- Decision: Diamond with one input and labelled outputs (Yes/No or True/False). Arrows from a decision symbol must be labelled to avoid ambiguity.
- Subroutine: Commonly drawn as a rectangle with double side bars (predefined process; this is common convention, check the symbol key in the paper), with its logic drawn as a separate flowchart of the same name.
- Standard structures only: Build flowcharts from sequence, selection and repetition only.
- Common errors: No Start/End, unlabelled decision arrows, loops that never end, flowing upward without a loop.
Drawing rules: DFD, structure chart, storyboard, decision tree, class diagram, ERD
- DFD process: Circle, named with a verb phrase (e.g. Validate vote), and must have at least one input and one output.
- DFD data store: A file or database (electronic or paper). Data moves between stores and processes only via a process, never directly to an external entity.
- DFD external entity: Person/organisation/system outside the boundary that sends or receives data (e.g. Voter, Electoral Commission).
- DFD flows: Labelled curved arrows with the name of the data (not the action).
- Level 0: One process for the whole system, external entities and labelled flows only. No data stores, no internal processes.
- Level 1 consistency: Inputs and outputs of the level 0 diagram must still appear (balanced) when you break the process into sub-processes.
- Structure chart: Top module = mainline; sub-modules below; empty circle = data passed; filled circle = flag; diamond = decision; curved arrow = repetition; refinement = separate chart named the same as the subroutine.
- Storyboard: One frame per screen with the layout, content and links (arrows) between screens; annotate what each button does.
- Decision tree: Show all possible combinations of decisions and resulting actions; each path ends in another decision or a final action; label branches with the conditions.
- Class diagram: Three-part boxes (name, attributes, methods); inheritance arrow from child to parent; show relationships and multiplicities (e.g. a student studies 1 or more subjects; a subject has 0 or more students).
- ERD (common convention): Entities as boxes, relationship lines with crow's feet for 'many', primary and foreign keys marked.
- UI drawing: Use labelled boxes for elements (heading, buttons, inputs, navigation), show consistent layout, readable fonts, contrast, and accessible features (alt text, large buttons).
- Gantt chart: Named tasks, estimated duration for each, dependencies, a clear time scale with dates and milestones; update with actual v estimated times.
- Process diary entries: Date, person, progress since last entry, tasks achieved, stumbling blocks and how managed, approaches for upcoming tasks, reflective comments, resources used.
- Wiring diagram: Standard symbols (resistor, capacitor, diode, LED, lightbulb, switch, motor, speaker, voltage source, integrated circuit, amplifier); show both data and power paths; label any extra component.
Part 2. School notes (Canvas, 12SENX2) by syllabus dot point
Corrections are marked in the text. Anything not marked is the school wording.
IPO
| Input | Process | Output |
|---|---|---|
Structure Chart
Structure charts are used to model the relationship between modules within a system. Using a hierarchical format, they can map the sequence of processes, data movement, and control parameters for interpretation. A structure chart can represent the control structure of sequence, selection, and iteration.
Key Points
- Additional Keywords: LET, Display, RETURN, GET, BEGIN, END
- Array: use array()
- Underline subroutine usage in both FLOWCHART and PSEUDOCODE
- Don’t underline the subroutine name in both FLOWCHART and PSEUDOCODE
- BEGIN _ and END _. _ should reflect the program purpose
Symbol
| Psuedocode | Flowchart |
|---|---|
| IF condition A THEN process 1 ELSEIF condition B THEN process 2 ELSEIF condition C THEN process 3 ELSE process 4 ENDIF |
|
| CASEWHERE expression evaluates to choice a: process a choice b: process b ... OTHERWISE: default process END CASE |
|
| WHILE condition is true process ENDWHILE |
|
| REPEAT process UNTIL condition is true |
|
| FOR variable = start TO finish STEP inc statements NEXT variable |
Data Flow Diagram
Always label data flow
Level 0 Data Flow should only have one Process named “___ System”
Desk Check
| Line number | Input | Var1 | VarI | Output |
|---|---|---|---|---|
Blank for non-instantiation
Fill for all instantiated variables regardless of if it has been changed within the line.
Part 3. Where this has been examined (see ../../question_bank.md)
| ID | Marks | Source | Topic / type |
|---|---|---|---|
| hsc2025-q15a | 3 | 2025 HSC | Data dictionary (dropdown (data dictionary)) |
| hsc2025-q17 | 3 | 2025 HSC | Algorithm design (pseudocode) |
| hsc2025-q22 | 3 | 2025 HSC | Modelling tools (drawing (class diagram)) |
| sample-q7 | 1 | Sample Exam | Python to pseudocode (multiple choice) |
| sample-q10 | 2 | Sample Exam | Structure charts (multi-select (structure chart)) |
| sample-q14 | 3 | Sample Exam | Algorithm design (subroutines) (pseudocode) |
| sample-q20b | 3 | Sample Exam | Decision trees (drawing (decision tree)) |
| sample-q24 | 4 | Sample Exam | Modelling tools (class diagram) (drawing (class diagram)) |
| fam-q4 | 2 | Familiarisation | Structure charts (multi-select (structure chart)) |
| fam-q7b | 3 | Familiarisation | Decision trees (drawing (decision tree)) |
| fam-q8 | 3 | Familiarisation | Algorithm design (linear search) (pseudocode (fix algorithm)) |
| fam-q9a | 3 | Familiarisation | Prototype and user interface design (drawing (user interface)) |
| sdd2022-q27 | 10 | Old SDD (old syllabus) | Modelling and design (IPO, data structure, Gantt) (extended) |
| sdd2023-q21 | 2 | Old SDD (old syllabus) | Prototypes (short answer / extended) |
| sdd2024-q24 | 10 | Old SDD (old syllabus) | Social and ethical issues (extended) |