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 (Edexcel), marked as you tap.
Decomposition and abstraction are two key ideas of computational thinking: breaking a problem into smaller parts, and leaving out detail that does not matter. This subtopic also covers why programmers use subprograms. Expect definitions and 'give' or 'explain' questions set in an unfamiliar scenario, usually worth 1 to 4 marks each.
Key facts
Decomposition: breaking a problem down into smaller, more manageable sub-problems
Abstraction: removing unnecessary detail to focus on what matters for the problem
A model of something in the real world is an abstraction of it
Subprogram: a named block of code that performs one task and runs when it is called
Function: returns a value. Procedure: does not return a value
Parameter: a value passed into a subprogram when it is called
Decomposition benefits: simpler parts, teamwork, parts tested separately, reuse
Decomposition means breaking a complex problem down into smaller sub-problems. You keep breaking each part down until it is simple enough to solve on its own.
Decomposition: keep breaking each part down until it is simple enough to solve on its own
Each sub-problem is easier to understand, solve and test than the whole problem.
Different people can work on different sub-problems at the same time, so the whole solution is finished sooner.
A sub-problem that comes up more than once, such as 'check that a date is valid', only needs solving once. The solution can then be reused.
Abstraction
diagram
Abstraction means removing (or hiding) unnecessary detail so that you can focus on the details that matter for solving the problem.
Any model of the real world is an abstraction. A sat nav's model of a town keeps the roads, junctions and speed limits, but leaves out the colour of the houses.
Which details matter depends on the purpose. A journey-time app needs distances and speed limits; a bus map for passengers only needs the stops and their order.
The bus map is an abstraction: houses, trees and the shape of the roads are left out because passengers do not need them
Abstraction makes a problem simpler to understand and solve, and the program simpler, quicker to write and less demanding on memory and processing.
Subprograms use abstraction too: to use len() you only need to know what it does, not how it works.
Subprograms
A subprogram is a named, self-contained block of code that carries out one task. It runs whenever the program calls it by its name. Each sub-problem from decomposition can become its own subprogram.
A function returns a value to the code that called it; a procedure carries out a task but does not return a value. Values are passed in through parameters.
This function is written once but can be called with any values. The call below outputs 12.
Benefits: the code is written once and called as many times as needed, so there is less repeated code and fewer chances for errors. Each subprogram can be tested on its own, so errors are easier to find.
More benefits: a change is made in one place only, so the program is easier to maintain; different programmers can write different subprograms at the same time; subprograms can be reused in other programs; the main program is shorter and easier to read.
How to answer each type of question
Define decomposition or abstraction
1 mark eachGrade 3
Give the key idea in one sentence.
Decomposition: breaking a problem down into smaller sub-problems.
Abstraction: removing unnecessary detail. Say that the detail is unnecessary, not just 'removing detail'.
Example. (a) Define the term decomposition. (b) Define the term abstraction.
Show the model answerHide the model answer
(a) Breaking a problem down into smaller, more manageable sub-problems
(1)
(b) Removing unnecessary detail so that only the features that matter for the problem are considered
(1)
Explain two benefits of using subprograms
2 to 4 marksGrade 5
Pick two different benefits, not the same idea twice.
For each one, add the consequence, joined with 'so'.
Use the scenario: name the program or the subprograms in the question.
Example. A team of three programmers is writing a quiz app for a museum. The app will be written as a set of subprograms, such as askQuestion() and updateScore(). Explain two benefits of writing the app as a set of subprograms.
Show the model answerHide the model answer
askQuestion() is written once and called for every question (1), so there is less code to write and fewer chances for errors (1). Each programmer can write a different subprogram at the same time (1), so the app is finished sooner
(1).
Also accept: each subprogram can be tested on its own, so errors are easier to find; a change is made in one place, so the app is easier to update.
Decompose a scenario into sub-problems
2 to 4 marksGrade 5
Read the scenario and underline each thing the system must do.
Write each sub-problem as a task that starts with a verb, e.g. 'calculate the fare'.
Give different tasks, not the same task twice in different words.
Example. A leisure centre wants a program that lets members book badminton courts online. Give three sub-problems that the program must solve.
Show the model answerHide the model answer
Any three from: log in / check the member's details (1); show which courts are free at each time (1); let the member choose a court and a time (1); take payment (1); send a booking confirmation (1); cancel a booking (1). Maximum 3 marks.
Explain how abstraction is used in a model
2 to 4 marksGrade 6
Say which details are kept, and why the purpose needs them.
Say which details are left out, and why they do not matter for the purpose.
Use details from the scenario, not general ones.
Example. A running app records a runner's position every 10 seconds. It uses the positions to work out the distance run and the average speed. Explain why the app's model of a run is an abstraction.
Show the model answerHide the model answer
It keeps only the details it needs to work out the distance and speed: the positions and the times they were recorded (1). It leaves out details that are not needed for these calculations, such as what the runner is wearing, the music they are listening to or the scenery (1).
Don’t lose marks
Mixing up the two terms: splitting a problem into parts is decomposition, not abstraction.
Writing 'abstraction removes detail' without saying that the detail is unnecessary or not relevant to the problem.
Saying that subprograms make a program run faster. That is not a benefit to give: the benefits are about writing, testing, reusing and maintaining code.
Giving the same benefit twice in different words, e.g. 'easier to read' and 'easier to understand'.
Giving vague answers in a scenario question. A sub-problem such as 'do the calculations' is too vague; say which calculation.
More tips
Memory tricks
Decomposition = break it down. Abstraction = leave it out.
Test for abstraction: does the program need this detail to do its job? If not, it can be left out.
Subprograms: 'write once, call many times'. Most of the benefits follow from this.
Subprogram benefits: RTMS = Reuse, Test on its own, Maintain in one place, Share the work.
Exam technique
In 'explain' questions a benefit usually earns one mark and its linked consequence a second, so join them with 'so' or 'because'.
In scenario questions, use the names, data and subprograms given in the question.
Write sub-problems as tasks (verb first). Examiners want things the program must do, not pieces of data.
If you are asked for details a model must include, choose ones that directly affect what the program works out or shows.
What each grade needs
What you need to be able to do, from the first marks up to the top grade.
Grade 3
Define decompositionBreaking a problem down into smaller sub-problems that are each easier to understand and solve.
Grade 3
Define abstractionRemoving or hiding unnecessary detail so that you can focus on what matters for the problem.
Grade 4
Give benefits of decompositionSub-problems are simpler, can be shared across a team, tested separately and reused.
Grade 5
Decompose a scenario into sub-problemsBreak a given system, such as an online booking service, into separate tasks.
Grade 5
State the benefits of using subprogramsCode is written once and called many times, and is easier to test, maintain and share.
Grade 6
Apply abstraction to a real-world modelSay which details a model must keep and which it can leave out, linked to its purpose.
Grade 7
Explain benefits in the context givenLink each benefit to the scenario with a clear consequence, e.g. '... so the app is finished sooner'.
Quick recall
Cover the answers and test yourself. The app has these as flashcards that come back just before you'd forget them.
A student is designing a program to manage bookings for a school’s after-school clubs. Define the term decomposition.
Breaking a problem down into smaller, more manageable sub-problems.
Name the technique of breaking a problem down into smaller, more manageable parts.
Decomposition
Give two sub-problems that the student could break the program into.
Any two, for example displaying the board and checking whether a player has won.
One of the sub-problems is ‘record an adoption’. Give one smaller sub-problem that it could be broken down into.
For example marking the dog as adopted.
Sample questions
Written for this site in the style of Edexcel exam questions. They are not taken from real past papers.
Question 1Easy3 marks
A student is designing a program to manage bookings for a school’s after-school clubs.
(a) Define the term decomposition.
[1]
(b) Define the term abstraction.
[1]
(c) Identify the example of abstraction in the booking program.
[1]
Splitting the program into a login section, a booking section and a report section
Storing each pupil’s name and form group, but not their home address or hair colour
Testing the program with boundary data
Adding comments to explain each subprogram
Show the answer and mark scheme
(a)Answer: Breaking a problem down into smaller, more manageable sub-problems.
breaking a (complex) problem down into smaller / more manageable sub-problems / parts
(b)Answer: Removing unnecessary detail so that only the important features of the problem are considered.
removing / ignoring unnecessary detail (to focus on what is needed to solve the problem)
(c)Answer: Storing each pupil’s name and form group, but not their home address or hair colour
Question 2Medium4 marks
A city council plans to change the timings of the traffic lights at a busy junction. Before making the change, it uses a computer simulation to model the traffic.
Explain two advantages of using a simulation rather than trying out the new timings on the real junction.
[4]
Show the answer and mark scheme
Answer: Safe (no one put at risk) and quick (many timings tested faster than real time, without disrupting traffic).
it is safe
because no real drivers or pedestrians are put at risk if the new timings cause problems
it is cheaper and causes no disruption
because traffic does not have to be stopped or diverted while timings are tested
many different timings can be tested quickly
because the simulation can run faster than real time and be repeated with the same conditions
unusual situations can be tested
e.g. very heavy traffic or an accident blocking one road
Question 3Hard4 marks
A city council’s traffic simulation predicted that new traffic-light timings would reduce queues at a junction by 20%. When the timings were introduced, the queues only fell by 5%.
(a) Give two reasons why the simulation’s results may have been different from what happened in reality.
[2]
(b) Describe how the council could improve the simulation for the future.
[2]
Show the answer and mark scheme
(a)Answer: The model left out real factors such as pedestrians and buses, and the traffic data may have been out of date.
the model is an abstraction: it leaves out some details that mattered, e.g. pedestrians, cyclists, buses, roadworks or weather
the data used may have been inaccurate, out of date or from a different time of year
real drivers do not always behave in the way the model assumes
the rules or calculations in the model may contain errors
(b)Answer: Compare its predictions with the new real data and adjust the model until they agree.
compare the simulation’s predictions with the real data collected after the change
adjust the model’s rules or data, or add the missing factors, until its predictions match reality more closely