Menu

Abstraction and Decomposition Exam Questions

14 Edexcel GCSE Computer Science (1CP2) exam-style questions on Abstraction and Decomposition (1.1 Decomposition and abstraction), 31 marks in all. Answer them on paper or print them, then open the mark schemes and example answers to see how each is marked.

Revise Abstraction and Decomposition first

Build a paper on 1.1 Decomposition and abstraction
Print
Download
1Multiple choice1 mark

A programmer is creating a simulation of a car park. The simulation will model the cars and the parking spaces.

Identify the benefit of using abstraction to model the car park.

[1 mark]
  • AIt allows the programmer to ignore details that do not affect the simulation
  • BIt allows the car park to be split into smaller sub-problems
  • CIt allows the programmer to reuse code in other programs
  • DIt allows the model to be an exact copy of the real world
Mark scheme
  • A It allows the programmer to ignore details that do not affect the simulation (1)
  • The only correct answer is A. The correct answer is it allows the programmer to ignore details that do not affect the simulation.
  • B is not correct because splitting a problem into smaller parts is decomposition
  • C is not correct because reusing code in other programs is a benefit of subprograms
  • D is not correct because abstraction removes detail and does not make an exact copy of the real world
Example answers and how they were marked
Full marks1/1

A It allows the programmer to ignore details that do not affect the simulation

Why: Correct option A (1).

No marks0/1

B It allows the car park to be split into smaller sub-problems

Why: B describes decomposition, not a benefit of abstraction, so earns 0.

No marks0/1

D It allows the model to be an exact copy of the real world

Why: D is the opposite of abstraction, which removes unnecessary detail, so earns 0.

2Multiple choice1 mark

A programmer is writing a program that uses subprograms.

Identify the main benefit of using subprograms in the program.

[1 mark]
  • AThey allow a block of code to be reused without being rewritten
  • BThey make all variables global so they can be used anywhere
  • CThey make the program run without any logic errors
  • DThey remove the need to test the program
Mark scheme
  • A They allow a block of code to be reused without being rewritten (1)
  • The only correct answer is A. The correct answer is that subprograms allow code to be reused.
  • B is not correct because subprograms do not make variables global
  • C is not correct because subprograms do not stop a program from having logic errors
  • D is not correct because a program still needs to be tested when subprograms are used
Example answers and how they were marked
Full marks1/1

A They allow a block of code to be reused without being rewritten

Why: Correct option A (1).

No marks0/1

C They make the program run without any logic errors

Why: C is a common misconception: subprograms do not remove logic errors, so earns 0.

No marks0/1

B They make all variables global so they can be used anywhere

Why: B is wrong because subprograms do not make variables global, so earns 0.

3Multiple choice1 mark

A student is writing a program to calculate the cost of a school trip.

Identify the way decomposition could be used to help solve this problem.

[1 mark]
  • AWrite one long section of code that calculates the whole cost at once
  • BSplit the problem into smaller tasks
  • CRemove details such as the number of students from the problem
  • DInclude every detail of the trip, such as the weather, in the program
Mark scheme
  • B Split the problem into smaller tasks (1)
  • The only correct answer is B. The correct answer is splitting the problem into smaller tasks.
  • A is not correct because one long section of code does not split the problem into smaller tasks
  • C is not correct because removing details from a problem is abstraction
  • D is not correct because including every detail is not abstraction and adds unnecessary complexity
Example answers and how they were marked
Full marks1/1

B Split the problem into smaller tasks

Why: Correct option B (1).

No marks0/1

C Remove details such as the number of students from the problem

Why: C describes abstraction, not decomposition, so earns 0.

No marks0/1

A Write one long section of code that calculates the whole cost at once

Why: A does not break the problem into smaller parts and is a common misconception about decomposition, so earns 0.

4Short recall1 mark

A computer game includes a model of a real-world car.

State one benefit of using abstraction when creating the model of the car.

[1 mark]
Mark scheme

Award one mark for any of the following:

  • Unnecessary/irrelevant details can be removed/hidden (1)
  • The model is simpler/easier to develop/understand (1)

Allow an example, e.g. the programmer does not need to model the engine temperature if it is not needed in the game.

Do not accept 'removes all detail' / 'makes the model more realistic'.

Example answers and how they were marked
Full marks1/1

Unnecessary details such as the engine temperature can be removed, so the model is simpler to develop.

Why: Unnecessary details removed/hidden (1); the simpler-to-develop point is part of the same benefit and the question is worth one mark.

No marks0/1

It removes all of the details from the car.

Why: Abstraction removes only unnecessary detail; the mark scheme does not accept 'removes all detail'.

No marks0/1

It makes the car look more realistic in the game.

Why: Abstraction simplifies the model; 'makes the model more realistic' is not a creditworthy point and is listed as not accepted.

5Short recall1 mark

A subprogram has been written to calculate the area of a circle.

State one benefit of using the subprogram in several different programs.

[1 mark]
Mark scheme

Award one mark for any of the following up to a maximum of one mark:

  • The code only has to be written once (1)
  • The subprogram can be reused/called many times/in several programs (1)
  • The subprogram only has to be tested/debugged once (1)
  • Other programmers can use the subprogram without knowing how it works/hides how the subprogram works (abstraction) (1)

Do not accept unqualified 'easier'/'faster'/'quicker'.

Do not accept makes the program(s) run faster/quicker (a subprogram does not make a program run faster).

Example answers and how they were marked
Full marks1/1

The area calculation only has to be written once, and the subprogram can be reused in each program.

Why: Written once (1); reuse is also creditworthy but the mark is capped at one.

No marks0/1

It is easier.

Why: Unqualified 'easier' is not accepted.

No marks0/1

It makes the programs run faster.

Why: Claims faster running, which the mark scheme does not accept; a subprogram does not make a program run faster.

6Short recall2 marks

Decomposition is a computational thinking technique.

Define the term decomposition.

[2 marks]
Mark scheme

Award one mark for any of the following up to a maximum of two marks:

  • Breaking down/splitting a problem/task/solution into smaller parts/sub-problems (1)
  • Each smaller part/sub-problem can be solved/analysed/understood separately (1)
  • Each smaller part/sub-problem can be broken down further (until each task is manageable) (1)
  • The solutions to the smaller parts are combined (to solve the whole problem) (1)
  • Allows a large/complex problem to be solved by different people/teams (1)

Do not accept removing/hiding unnecessary detail (this is abstraction).

Do not accept a named example on its own, e.g. 'making the score and the movement separate parts of the game', with no definition.

Example answers and how they were marked
Full marks2/2

Decomposition is breaking a large problem down into smaller sub-problems. Each of these smaller parts can then be solved separately.

Why: Breaking a problem into smaller sub-problems (1) and each smaller part solved separately (1).

Some marks1/2

Decomposition is splitting a problem into smaller parts.

Why: Gives breaking a problem into smaller parts (1), but does not say that the smaller parts are solved or understood separately.

No marks0/2

Decomposition is removing unnecessary detail from a problem so that the important parts are left.

Why: This describes abstraction, which the mark scheme does not accept.

7Describe2 marks

Computer programs can be used to model real-world objects and systems.

Describe one benefit of using abstraction to model an aspect of the real world.

[2 marks]
Mark scheme

Award up to two marks for a linked description such as:

  • Unnecessary detail is removed/ignored (1) so the programmer can focus on the features that matter to the problem (1)
  • The model only includes the parts of the real-world thing that the program needs (1) so less code/data is needed to represent it (1)
  • A complicated real-world object/system is replaced by a simpler model (1) which is easier to analyse/understand (1)

Do not accept responses that describe decomposition.

Do not accept responses that say abstraction makes a model more realistic or more detailed.

Do not award credit for generic statements about abstraction, such as that it makes a program faster, with no linked benefit for the model.

Example answers and how they were marked
Full marks2/2

Abstraction removes the details that are not needed, such as how heavy a dice is, so the programmer only has to write code for the parts of the dice that the game actually uses.

Why: Unnecessary details removed (1) linked to only coding the parts the program needs (1).

Some marks1/2

Abstraction removes the unnecessary detail from a problem.

Why: Gives the first point (1) but no linked development.

No marks0/2

Abstraction makes the model look exactly like the real thing, so the game is more realistic for the player.

Why: Reverses the meaning of abstraction: keeping more detail is not credited, and there is no creditworthy point.

8Describe2 marks

A programmer is writing a large program to control a delivery robot.

Describe one benefit of using decomposition to solve this problem.

[2 marks]
Mark scheme

Award up to two marks for a linked description such as:

  • Solving each sub-problem/smaller part on its own (1) is easier than solving the whole (large) problem at once (1)
  • Each sub-problem/smaller part can be tested separately (1) so errors are easier to find and fix (1)
  • Different programmers can work on different sub-problems/smaller parts (1) at the same time/so the work can be shared and finished more quickly (1)
  • The solution to one sub-problem/smaller part can be reused (1) in other parts of the program/other programs, so it does not have to be written again (1)

Do not accept a definition of decomposition on its own with no benefit, e.g. 'breaking a large problem into smaller parts', or responses that describe abstraction, e.g. removing/hiding unnecessary detail (0).

Example answers and how they were marked
Full marks2/2

Each sub-problem can be tested separately, so errors are easier to find and fix.

Why: Separate testing of each sub-problem (1) linked to errors being easier to find and fix (1).

Some marks1/2

Each sub-problem can be solved on its own.

Why: Gives the first point, solving each sub-problem separately (1), but no linked development about why this is easier or better.

No marks0/2

Decomposition means breaking a large problem down into smaller sub-problems.

Why: Definition only, with no benefit described, so no creditworthy linked point. The mark scheme's 'Do not accept' line rules this out.

9Describe2 marks

A programmer is writing a program that uses several subprograms.

Describe one benefit of using subprograms when writing a program.

[2 marks]
Mark scheme

Award up to two marks for a linked description such as:

  • A subprogram only has to be written once (1) so the same code does not have to be rewritten/typed again (1)
  • A subprogram can be reused/called in other programs (1) which saves development time (1)
  • A subprogram can be tested/debugged on its own (1) so errors are easier to find and fix (1)
  • A subprogram only has to be changed/updated in one place (1) so the program is easier to maintain/update (1)
  • A subprogram can be given a name that describes what it does (1) so the main program is shorter/easier to read and understand (1)

Do not accept responses that describe abstraction (such as hiding the detail of how the code works) or decomposition (such as splitting the work between programmers), or that state that subprograms make the program run faster.

Example answers and how they were marked
Full marks2/2

A subprogram only has to be written once, so the programmer does not have to write the same code again, which saves time.

Why: Written once (1) linked to not having to rewrite the code/saving time (1).

Some marks1/2

Subprograms can be reused.

Why: Gives the first mark of the reuse point (1) but no linked development.

No marks0/2

Subprograms make the program run faster because the computer skips over the code inside them.

Why: Only claims a benefit that subprograms do not bring, which the mark scheme does not accept; no creditworthy point.

10Explain2 marks

A flight simulator is a computer program that models a real aircraft.

Explain one benefit of using abstraction when modelling the aircraft in the flight simulator.

[2 marks]
Mark scheme

Award up to two marks for a linked explanation such as:

  • The model is simpler/quicker to create (1) because unnecessary details of the real aircraft are removed/ignored (1)
  • The program uses less memory/processing (1) because only the essential parts of the aircraft are stored/calculated (1)
  • The model is easier to test/update (1) because there are fewer features to check/change (1)

For both marks, the expansion must follow/associate with the statement.

A benefit stated on its own, without a linked reason, can earn one mark.

Allow equivalent benefits such as the simulator runs faster or needs less storage (1) with a linked reason such as only the essential parts of the aircraft are modelled (1)

Allow the model is easier to understand (1) because the details that do not matter are hidden (1)

Do not accept 'it removes detail'/'it hides detail' on its own without stating a benefit of doing so.

Do not accept benefits of decomposition, such as 'different programmers can write different parts'.

Do not accept 'the user cannot see the code' or 'it is more secure'.

Example answers and how they were marked
Full marks2/2

The simulator will use less memory because only the important parts of the aircraft, such as the controls, are stored and the unnecessary details are removed.

Why: Linked point (1) and reason (1): less memory is named and linked to storing only the essential parts.

Some marks1/2

The simulator uses less memory.

Why: States the benefit (1) but gives no linked reason, so the second mark is not earned.

No marks0/2

Abstraction hides the code so the user cannot change the aircraft.

Why: Hiding the code from the user is not a benefit of modelling the real world, so no mark is awarded.

11Explain2 marks

A team of programmers is writing a large program to manage book loans in a school library.

Explain one benefit of using decomposition when writing this program.

[2 marks]
Mark scheme

Award up to two marks for a linked explanation such as:

  • Each part of the program can be written by a different programmer (1) so the program is completed more quickly (1)
  • Each smaller problem can be solved on its own (1) so a programmer can focus on one task at a time (1)
  • Each part can be tested separately (1) so errors are easier to find/fix (1)
  • Parts of the program can be reused (1) so less code needs to be written (1)
  • The finished program is easier to understand/manage (1) because it is split into smaller parts that each do one job (1)

For both marks, the expansion must follow/associate with the statement.

Only award the second mark where the benefit is expanded with a linked reason.

Do not accept 'it breaks the problem into smaller parts' on its own, as this repeats the question without a benefit.

Do not accept 'it is easier' without saying what is easier, such as easier to understand, test or write.

Do not accept benefits of abstraction, such as 'it removes/hides unnecessary details'.

Do not award the second mark for 'it is quicker' unless the answer says why, such as the work being shared between programmers or code being reused.

Example answers and how they were marked
Full marks2/2

Different programmers can write different parts of the program so the work is finished more quickly.

Why: Linked point (1) and reason (1): sharing the parts between programmers is linked to finishing more quickly.

Some marks1/2

It is easier to test each part of the program.

Why: Gives the point that each part can be tested separately (1) but no linked reason, such as errors being easier to find, so the second mark is not awarded.

No marks0/2

It removes the unnecessary details from the library program, so it is quicker to write.

Why: This describes abstraction rather than decomposition, so no mark is awarded.

12Explain2 marks

A game program contains a subprogram that calculates a player's score.

Explain one benefit of using a subprogram to calculate the score.

[2 marks]
Mark scheme

Award up to two marks for a linked explanation such as:

  • The same subprogram can be called/used more than once (1) so the code does not need to be written/typed again (1)
  • The subprogram can be tested on its own/separately (1) so any errors in the calculation are easier to find/fix (1)
  • A change/update to the calculation only needs to be made in one place (1) so the program is easier to maintain/update (1)
  • Work can be shared between programmers (1) so the program is completed/written more quickly (1)
  • The subprogram can be reused/copied into another program (1) so less time is spent writing/developing new code (1)

For both marks, the expansion must follow/associate with the statement.

Do not accept 'it is easier' on its own without an expansion of what is easier.

Do not accept 'it is a small piece of code'/'it breaks the program up' on its own without a benefit of using the subprogram.

Do not award 'it removes unnecessary detail' as this describes abstraction, not a benefit of using a subprogram.

Example answers and how they were marked
Full marks2/2

The subprogram can be called every time a player scores so the same code does not need to be written again.

Why: Linked point (1) and reason (1): calling the subprogram more than once is linked to the code not needing to be rewritten.

Some marks1/2

The subprogram can be reused.

Why: Gives the benefit (1) but no linked reason, so the second mark is not earned.

No marks0/2

The subprogram removes the unnecessary details of the score, so the game is more realistic.

Why: This describes abstraction of the real world, not a benefit of using a subprogram, so no mark is awarded.

13Discuss6 marks

A hospital wants a computer program that simulates how patients move through its emergency department. The program will be used to test changes to staffing and room layout.

Discuss what the hospital would gain from using abstraction and decomposition when building this simulation.

Your answer should include:

  • details that could be abstracted from the real department
  • how the problem could be decomposed
  • the benefits of these techniques for this simulation
[6 marks]
Mark scheme

Indicative content

Details that could be abstracted from the real department

  • Details that do not affect how patients move through the department, such as the colour of the walls or the names of the staff, could be left out of the model.
  • Each patient could be represented using only the data the simulation needs, such as arrival time, triage category and treatment time, instead of a full medical record.
  • Staff could be modelled as a resource with a role and an availability, rather than as named individuals.
  • Rooms and corridors could be represented as connected spaces with a capacity, ignoring their exact size and the furniture in them.
  • The passing of time could be modelled in fixed steps, ignoring the real clock time of each event.

How the problem could be decomposed

  • The simulation could be split into stages, such as patients arriving, triage, treatment and discharge.
  • Each stage could be written as a separate subprogram, for example one subprogram to generate patient arrivals and another to assign a room.
  • The rules for allocating staff could be built as a separate part from the department layout.
  • A separate part could produce the results, such as the waiting times and queue lengths.
  • The separate parts could be combined to produce the whole simulation, in the same way that subprograms are called from a main program.
  • Different programmers in the team could work on different parts at the same time.

The benefits of these techniques for this simulation

  • Only the factors that affect patient flow are included, so the results the hospital gets back are the waiting times and queue lengths it wants to test.
  • A change to staffing or to the room layout only has to be made in one part, so the hospital can test two layouts without the whole program being rewritten.
  • An error in one stage, such as triage, can be found and fixed without affecting the other stages, so the simulation is more reliable.
  • The parts can be reused, for example the subprogram that generates arrivals could be used again when the hospital tests a different layout.
  • Smaller parts are easier to understand and test on their own before they are combined, so the simulation is quicker to develop.

Guidance

Level 3 responses must cover both abstraction and decomposition, with benefits clearly applied to the hospital simulation.

Do not accept abstraction described as adding detail to the model, or decomposition described as testing the finished program; a response that only says detail is removed, without naming any detail of the emergency department, cannot go beyond Level 1.

Levels

  • Level 0 (0 marks): No rewardable content.
  • Level 1 (1–2 marks): Basic, independent points are made, showing elements of understanding of key concepts/principles of computer science. (AO1) The discussion will contain basic information with little linkage between points made or application to the context. (AO2)
  • Level 2 (3–4 marks): Demonstrates adequate understanding of key concepts/principles of computer science. (AO1) The discussion shows some linkages and lines of reasoning with some structure and application to the context. (AO2)
  • Level 3 (5–6 marks): Demonstrates comprehensive understanding of key concepts/principles of computer science to support the discussion being presented. (AO1) The discussion is well developed, with sustained lines of reasoning that are coherent and logically structured, and which clearly apply to the context. (AO2)
Example answers and how they were marked
Full marks6/6

Abstraction would let the hospital leave out anything that does not change how patients move through the department, such as the colour of the walls, the names of the staff or the exact size of each room. Each patient would be stored with only the data the simulation needs, such as arrival time, triage category and treatment time, instead of a full medical record, and the staff could be modelled as a resource with a role and an availability. The department could be modelled as connected spaces with a capacity, because it is the space and the staff that decide how long a patient waits. The problem could then be decomposed into stages: patients arriving, triage, treatment and discharge. Each stage could be its own subprogram, with a separate part producing the waiting times and queue lengths. This helps the hospital because a change to staffing or room layout only has to be made in one subprogram, so it can compare two layouts without rewriting the whole program, and an error in one stage can be fixed without breaking the others. Because the model holds only the factors that affect patient flow, the tests run quickly and the results are easier to interpret, so the hospital can make decisions about the new department using evidence.

Why: Gives several applied abstraction points (wall colour, patient record, staff as a resource, rooms as capacity), decomposes into named stages with subprograms, and sustains applied benefits (one change in one subprogram, comparing layouts, fixing errors safely, faster tests) across both techniques (Level 3).

Some marks2/6

Abstraction means removing unnecessary detail. Decomposition means breaking a problem into smaller parts. The hospital could remove details like the colour of the walls. This makes the program simpler. Breaking the problem down makes it easier to solve because there are smaller problems. The developers could split the code into subprograms. This helps them test each part. It also means they can share the work.

Why: Abstraction is correct and the wall colour detail is applied (1), and decomposition is defined and linked to subprograms (1), but the stages of the simulation are not named and the benefits are basic and not applied to the emergency department, so there is little linkage (Level 1).

No marks0/6

Abstraction means adding more detail to the model so it is realistic, such as including every patient's medical history. Decomposition means testing the program at the end. This will make the simulation better because it will be like the real hospital.

Why: Abstraction is described as adding detail, which is the reverse of the technique, and decomposition is described as testing, so neither technique is defined or applied correctly and no creditworthy point is made (Level 0).

14Discuss6 marks

A small company is developing a fitness app. The app will record runs, calculate calories, store a user's history and show a weekly summary. Two programmers will work on the app.

Discuss how decomposition and subprograms could help the company develop and maintain the fitness app.

Your answer should consider:

  • how the app could be broken down
  • the benefits of using subprograms
  • how this helps the two programmers
[6 marks]
Mark scheme

Indicative content

How the app could be broken down

  • Into separate parts such as recording a run, calculating calories, storing history and producing the weekly summary.
  • Each part could be a subprogram, for example calculateCalories(distance, time).
  • The user interface could be separate from the data storage.
  • The app could be split into modules that the two programmers can work on independently.
  • The weekly summary could reuse subprograms that read the stored runs.

Benefits of using subprograms

  • Code can be written once and called many times, for example the calorie calculation used for every run.
  • A subprogram hides its internal logic, so a programmer can call it without knowing how it works.
  • Subprograms make code easier to read and understand because each has a clear name and purpose.
  • A subprogram can be tested on its own before it is added to the app.
  • Errors are easier to find and fix in a smaller subprogram.
  • A subprogram can be reused in another app or a later version.

How this helps the two programmers

  • They can work on different subprograms at the same time, saving development time.
  • Each programmer needs to know only the inputs and outputs of the other programmer's subprogram, not its internal code.
  • One programmer can change a subprogram without affecting the other's code, as long as the interface stays the same.
  • Work can be combined more easily because the parts are separate.
  • Testing can be divided between them.

Levels

  • Level 0 (0 marks): No rewardable content.
  • Level 1 (1–2 marks): Basic, independent points are made, showing elements of understanding of key concepts/principles of computer science. (AO1) The discussion will contain basic information with little linkage between points made or application to the context. (AO2)
  • Level 2 (3–4 marks): Demonstrates adequate understanding of key concepts/principles of computer science. (AO1) The discussion shows some linkages and lines of reasoning with some structure and application to the context. (AO2)
  • Level 3 (5–6 marks): Demonstrates comprehensive understanding of key concepts/principles of computer science to support the discussion being presented. (AO1) The discussion is well developed, with sustained lines of reasoning that are coherent and logically structured, and which clearly apply to the context. (AO2)

Level 3 responses must cover both decomposition and subprograms.

Do not accept vague statements such as 'subprograms are easier' without a reason.

Example answers and how they were marked
Full marks6/6

The company could decompose the app into separate parts: recording a run, calculating calories, storing history and creating the weekly summary. Each part can be a subprogram, for example calculateCalories(distance, time). A subprogram is written once and called every time a run is saved, so the calorie code is not repeated. Subprograms also hide their internal logic, so one programmer can call calculateCalories without needing to know how it works. This lets the two programmers work on different subprograms at the same time, and they only need to agree on the inputs and outputs. Each subprogram can be tested on its own, so errors are easier to find. If the weekly summary needs to change, only that subprogram is edited, which reduces the risk of breaking the rest of the app.

Why: Decomposes the app into parts, explains reuse, hidden logic and testing benefits of subprograms, and links these clearly to the two programmers' work (Level 3).

Some marks4/6

Decomposition means breaking the app into smaller parts, like recording a run and showing the summary. This makes it easier to solve. Subprograms can be reused, so the calorie calculation only has to be written once. Subprograms also make the code easier to read. The two programmers can work on different parts, which saves time.

Why: Gives an applied decomposition and some benefits of subprograms and teamwork, but the reasoning is brief and not developed into a sustained discussion (Level 2).

No marks0/6

Decomposition means removing unnecessary details so the app is simpler. Subprograms are used to store the user's history in a database. This means the two programmers can both use the same data. Subprograms make the app easier to use for the customer.

Why: Confuses decomposition with abstraction and treats subprograms as data storage, so no creditworthy point about decomposition or subprograms is made (Level 0).

Keep practising Abstraction and Decomposition

Teachers: print these as a worksheet with the mark schemes at the end, and sign your school up to set your classes activities on Abstraction and Decomposition.

Fetch Decode Explain isn't affiliated with or endorsed by Pearson Edexcel.