Structure Charts (Cambridge (CIE) A Level Computer Science): Revision Note
Exam code: 9618
Structure charts
What is a structure chart?
A structure chart is a modelling tool used in the design stage of program development
It helps to decompose a problem into smaller, manageable sub-tasks, representing each as a module
Structure charts focus on what the program does, not how it does it
Example
A program that asks a user to enter their username and password
Checks if the password matches the stored password and uses a counter to track how many times it is checked
If the password matches, a successful message is displayed, else after three failed attempts a 'denied' message is displayed
A structure chart might look like:

Key features
Feature | Explanation |
---|---|
Top-down design | The chart starts with the main program and breaks it into sub-modules |
Decomposition | Each module represents a specific task or function |
Module boxes | Each module is shown as a box |
Vertical lines | Show control flow – which module calls which |
Parameter arrows | Arrows pointing into modules show data being passed in or returned |
Stepwise refinement | Each level adds more detail to the task above |
Diamond shape | Shows a condition that could be true or false |
Semi-circular arrow | Indicates repetition |
Pseudocode from structure chart
The first step is to create an identifier table
Identifier | Data type | Description |
---|---|---|
| STRING | Stores the username entered by the user |
| STRING | Stores the password entered by the user |
| STRING | The correct password stored in the system for comparison |
| INTEGER | Counts the number of failed login attempts |
| BOOLEAN | Indicates whether the login was successful |
Next, identify is any functions or procedures could be used
Module | Type | Purpose |
---|---|---|
| PROCEDURE | Asks the user to input username and password |
| FUNCTION | Compares input password with stored password and returns TRUE/FALSE |
| PROCEDURE | Displays success or failure message |
Any finally, write the pseudocode
DECLARE Username : STRING
DECLARE Password : STRING
DECLARE StoredPass : STRING
DECLARE NoAttempts : INTEGER
DECLARE LoginSuccess : BOOLEAN
StoredPass ← "admin123"
NoAttempts ← 0
LoginSuccess ← FALSE
PROCEDURE GetCredentials()
OUTPUT "Enter username: "
INPUT Username
OUTPUT "Enter password: "
INPUT Password
ENDPROCEDURE
FUNCTION CheckPassword(P : STRING) RETURNS BOOLEAN
IF P = StoredPass THEN
RETURN TRUE
ELSE
RETURN FALSE
ENDIF
ENDFUNCTION
PROCEDURE ShowAccessMessage(Success : BOOLEAN)
IF Success = TRUE THEN
OUTPUT "Login successful"
ELSE
OUTPUT "Access denied"
ENDIF
ENDPROCEDURE
WHILE NoAttempts < 3 AND LoginSuccess = FALSE
CALL GetCredentials()
LoginSuccess ← CheckPassword(Password)
IF LoginSuccess = FALSE THEN
OUTPUT "Incorrect password"
NoAttempts ← NoAttempts + 1
ENDIF
ENDWHILE
CALL ShowAccessMessage(LoginSuccess)
You've read 0 of your 5 free revision notes this week
Unlock more, it's free!
Did this page help you?