75 exam-style questions on this topic, at up to four difficulty levels, with full mark schemes. Notes and past-paper booklets are open to everyone. Practice needs a free account.
Or take a quick quiz: 10 questions on this subtopic in GCSE Computer Science (OCR), marked as you tap.
Before you design an algorithm you identify what goes in (inputs), what the program does (processes) and what comes out (outputs). A structure diagram shows how a problem has been decomposed into smaller parts. Expect input/process/output tables and completing or drawing structure diagrams, often at the start of a Section B scenario.
Key facts
Input = data into the program (keyboard, file, sensor)
Process = what is done with the data (calculate, compare, validate, search, sort)
Output = results out of the program (screen, printer, file, speaker)
Structure diagram = hierarchy of boxes showing a problem broken into sub-problems
Top box = the whole problem; lower levels = smaller sub-problems
Bottom-level boxes = small tasks, often one sub program each
No decisions, loops or arrows in a structure diagram
Notes
Inputs, processes and outputs
diagram
Input: data that goes into the program, for example typed by the user, read from a file or taken from a sensor.
Process: what the program does with the data, for example calculations, comparisons, validation, searching or sorting.
Output: the information the program produces, for example shown on screen, printed, written to a file or played as a sound.
Quick guide: if the user types it in, it is an input; if the user sees or receives it, it is an output; everything the program works out in between is a process.
Example: a car park program. Inputs: the number of hours parked, and whether the driver has a blue badge. Processes: check the hours are valid; calculate the charge at £2 per hour, or £0 for a blue badge. Output: the charge.
Input, process and output for the car park program
Structure diagrams
diagram
A structure diagram shows the decomposition of a problem (top-down design) as a hierarchy of boxes.
The box at the top is the whole problem. Each level below breaks a box into smaller sub-problems, joined to it by lines.
Read each level from left to right. The boxes at the bottom should be small enough to code as one module, such as a sub program.
A structure diagram has no decision symbols, loops or arrows: it shows how the problem is broken down, not how the program flows from step to step.
Example: Quiz game breaks down into Set up, Play round and End game. Set up breaks down into Load questions and Reset score; Play round into Ask question, Check answer and Update score.
Why use them
They show the structure of the whole program before any code is written.
Each module can be given to a different programmer, and coded and tested on its own.
They make it easier to spot tasks that repeat, which can be written once as a sub program and reused.
How to answer each type of question
Complete an input, process, output table
3 marksGrade 4
Underline the data the user enters: these are the inputs.
Underline what is shown or produced: these are the outputs.
Everything worked out or checked in between goes in processes.
Example. A program asks for the length and the width of a rectangular room in metres. It works out the floor area and the cost of carpet at £12 per square metre, then displays the cost. Complete a table showing the input(s), process(es) and output(s) of the program. [3]
Show the model answerHide the model answer
Input(s)
Process(es)
Output(s)
The length and the width of the room (1)
area = length × width; cost = area × 12 (1)
The cost of the carpet (1)
Draw or complete a structure diagram
3 to 4 marksGrade 6
Put the name of the whole system in one box at the top.
Put the main tasks on the second level, left to right.
Break any task the question describes into smaller boxes under it.
Check that every box belongs under the box above it.
Example. A library app lets members log in, search for a book and reserve a book. Logging in involves entering a username, entering a password and checking the details. Searching can be by title or by author. Draw a structure diagram for the app. [4]
Show the model answerHide the model answer
Top box: Library app
(1).
Second level: Log in, Search, Reserve
(1).
Under Log in: Enter username, Enter password, Check details
(1).
Under Search: By title, By author
(1).
Explain the benefit of a structure diagram
2 marksGrade 7
Say what the diagram does: breaks the problem into separate modules.
Say how that helps the programmers, linked to the context.
Example. Explain one way a structure diagram helps a team of programmers who are writing a large program. [2]
Show the model answerHide the model answer
It breaks the problem down into separate modules (1) so each module can be given to a different programmer, and coded and tested separately (1).
Don’t lose marks
Writing 'the user presses Enter' as an input instead of naming the data that is entered.
Putting 'display the total' under processes: showing something is an output.
Drawing a flowchart, with decisions and arrows, when a structure diagram is asked for.
Putting a sub-task under the wrong parent box, or leaving out the top box.
More tips
Memory tricks
IPO: In, Process, Out. Typed in = input; seen or received = output; worked out = process.
A structure diagram is like a family tree for a program: the whole system at the top, its parts below.
Check a structure diagram by reading any box and asking: is this part of the box above it?
Exam technique
Use the words from the scenario for inputs and outputs, such as 'the number of tickets'.
Keep each box short: a verb and a noun, such as 'Check password'.
Section B often starts with an input, process, output question on the scenario: it is a quick way to pick up marks.
What each grade needs
What you need to be able to do, from the first marks up to the top grade.
Grade 3
Identify the inputs and outputs of a problemPick out the data that goes in and the results that come out of a described program.
Grade 4
Identify the processes in a problemName what the program does with the data, such as calculating, checking or sorting.
Grade 4
Describe what a structure diagram showsIt shows a problem broken down into smaller sub-problems as a hierarchy of boxes.
Grade 5
Complete a partly drawn structure diagramAdd the missing boxes at the correct level, under the correct parent box.
Grade 6
Draw a structure diagram for a scenarioPut the whole system at the top and break it down over two or more levels.
Grade 7
Explain how structure diagrams help developmentEach module can be coded and tested separately, shared between programmers and reused.
Quick recall
Cover the answers and test yourself. The app has these as flashcards that come back just before you'd forget them.
State what is meant by an input to a program.
Data that goes into the program from the user or a device.
‘The user types in the amount they have spent.’ Write I for input, P for process or O for output.
I (input)
The structure diagram below is shown as an indented list. Each indented item is a sub-problem of the less indented item above it.
Homework planner
Add homework
Enter the subject
Enter the due date
View homework
Delete homework
How many sub-problems is ‘Add homework’ split into?
2
A process is a calculation or decision that the program carries out on data.
True
A program asks the user for their score in a game. If the score is over 50, it shows the message ‘Well done’. Otherwise it shows ‘Try again’. State the input.
The score.
A program converts a distance in kilometres into metres. It uses 1 km = 1000 m. State the input.
The distance in kilometres.
Sample questions
Written for this site in the style of OCR exam questions. They are not taken from real past papers.
Question 1Easy3 marks
(a) A program for a school canteen records the items a pupil chooses and prints a receipt. Which one of these is a process? Tick (✓) one box.
[1]
The pupil scanning their ID card
Adding up the prices of the items chosen
Printing the receipt
Displaying the menu on a screen
(b) State what a structure diagram shows.
[1]
(c) Give one advantage of drawing a structure diagram before writing a program.
[1]
Show the answer and mark scheme
(a)Answer: Adding up the prices of the items chosen
(b)
how a problem / program is broken down into smaller sub-problems / modules (and how they are related)
(c)
shows the modules / sub-programs that need to be written
helps to decompose the problem so each part is easier to solve
parts can be given to different programmers
gives an overview of the whole solution / shows how the parts fit together
Question 2Medium6 marks
A car park charges £2.50 for each hour or part of an hour, up to a maximum charge of £15.00. A program is given the number of minutes a car has been parked and outputs the charge.
(a) State the input to this program.
[1]
(b) Describe the processing that the program must carry out.
[3]
(c) State the output of the program when a car has been parked for 130 minutes.
[1]
(d) Explain why the program does not need to know the registration number of the car.
[1]
Show the answer and mark scheme
(a)
the number of minutes (the car has been parked)
(b)
convert the minutes to hours, rounding any part of an hour up (e.g. hours = (minutes + 59) DIV 60)
multiply the number of hours by 2.50
if the charge is more than 15.00, set it to 15.00
(c)Answer: £7.50 (3 hours or part hours) £
£7.50
(d)
the charge only depends on the time parked / the registration number is not used in the calculation
Question 3Hard10 marks
A smart greenhouse is controlled by a computer program. Sensors measure the temperature, the moisture of the soil and the light level. The program can open or close a window, switch a heater on or off and switch a water sprinkler on or off.
(a) Identify two inputs and two outputs of the program.
[4]
(b) The program must keep the temperature between 18 °C and 26 °C. Describe the processing needed to control the temperature.
[3]
(c) Draw a structure diagram for the greenhouse program. Your diagram should have at least two levels below the top box.
[3]
Show the answer and mark scheme
(a)
input: one sensor reading, e.g. the temperature / soil moisture / light level
input: a second, different sensor reading
output: one control signal, e.g. to open / close the window
output: a second, different control signal, e.g. to switch the heater / sprinkler on or off
(b)
read the temperature repeatedly / in a loop
if the temperature is below 18, switch the heater on (and close the window)
if the temperature is above 26, switch the heater off / open the window
otherwise (18 to 26) switch the heater off and close the window / leave them unchanged
wait a set time before checking again
(c)
a top box for the whole system, e.g. "Greenhouse controller"
at least three sensible modules at the next level, e.g. control temperature, control watering, read sensors
at least one module broken down further, e.g. "control temperature" into "read temperature", "control heater", "control window"
More in Designing, creating and refining algorithms