Edexcel GCSE CS · 1.1
Decomposition and Abstraction
Name
Class
Date
Mark / 27
Section A
Circle the letter of the correct answer. One mark each.
- 1Which of these best defines decomposition?1
- AWriting a program in a low level language
- BReducing the size of a file so it takes less storage
- CRemoving unnecessary detail from a problem
- DBreaking a complex problem into smaller sub problems that can be solved separately
- 2A game designer decides that cars in a racing game will not model the chemistry of tyre rubber. This is an example of:1
- ACompression
- BAbstraction
- CDecomposition
- DValidation
- 3Why does decomposition make a large program easier to debug?1
- AEach sub problem can be tested on its own, so a fault can be traced to one part
- BIt makes the program run faster
- CIt automatically removes syntax errors
- DIt reduces the number of variables needed
- 4Which detail would a program that calculates the shortest driving route most likely abstract away?1
- AThe length of each road
- BThe colour of the buildings along each road
- CThe speed limit on each road
- DWhich junctions connect to which
- 5A team splits a shopping website into login, product search, basket and payment. This is:1
- AIteration
- BEncryption
- CDecomposition
- DAbstraction
- 6Which is a genuine benefit of abstraction when writing a program?1
- AThe source code becomes impossible to copy
- BEvery variable is automatically validated
- CLess data needs to be stored and processed, so the program runs faster
- DThe program will contain no logic errors
- 7What is the main risk of abstracting away too much detail?1
- AThe model may no longer behave enough like the real system to be useful
- BThe program will not compile
- CThe program will need more memory
- DThe file will become larger
- 8Which statement about sub programs and abstraction is correct?1
- ACalling a sub program hides how the task is done from the code that calls it
- BSub programs can only be used once in a program
- CSub programs remove the need for variables
- DSub programs make a program run in less memory in every case
- 9A hospital system is decomposed into 'store patient records', 'book appointments' and 'issue prescriptions'. What is the clearest advantage?1
- AThe system will need no testing
- BThe system will use less electricity
- CThe records will automatically be encrypted
- DThree developers can work on the three parts at the same time
- 10Which pair correctly matches the technique to the action?1
- AAbstraction: dividing a system into login, basket and payment
- BDecomposition: storing only a product code, price and quantity in a basket
- CAbstraction: storing only a product code, price and quantity in a basket
- DDecomposition: ignoring the colour of the packaging
Section B
Answer in the space provided. The number of marks tells you how many separate points to make.
- 1StateState what is meant by the term decomposition.2
- 2ExplainA supermarket is developing an app that lets customers scan items and pay without visiting a till. Explain how decomposition would be used when developing this app.4
- 3ExplainExplain what is meant by abstraction and give one reason why it is used.3
- 4DescribeA weather app models rainfall across a country. Describe two details the developers would keep and two they would remove, and justify your choices.4
- 5CompareCompare decomposition and abstraction, making clear how they differ.4
Mark scheme
Section A
Section B
1 State what is meant by the term decomposition. 2
One mark for each of the following, to a maximum of 2.
- Breaking a large or complex problem into smaller parts or sub problems
- So that each part can be solved, tested or understood separately
Model answer. Decomposition means breaking a large and complex problem down into a number of smaller sub problems. Each sub problem is small enough to be understood, solved and tested on its own, and the solutions are then combined to solve the original problem.
2 A supermarket is developing an app that lets customers scan items and pay without visiting a till. Explain how decomposition would be used when developing this app. 4
One mark for each of the following, to a maximum of 4.
- The overall problem is broken into smaller sub problems
- Names sensible sub problems for this scenario, such as scanning a barcode, keeping a running total, taking payment or checking the customer out
- Each sub problem can be written and tested independently
- Different developers can work on different parts at the same time, and a fault can be traced to a single part
Model answer. Decomposition would be used to break the whole app down into smaller sub problems that can each be tackled on their own. Sensible sub problems here would be reading a barcode from the camera, looking that barcode up to find the product and its price, keeping a running total of the basket, applying any offers, taking a card payment and producing a digital receipt. Each of these can be written and tested independently, so the payment code can be proved correct before it is ever joined to the scanning code. Splitting the work this way also allows several developers to build different parts at the same time, and if the finished app produces a wrong total the fault can be traced to a single sub program rather than searched for across the whole system.
3 Explain what is meant by abstraction and give one reason why it is used. 3
One mark for each of the following, to a maximum of 3.
- Removing or hiding detail that is not needed to solve the problem
- Only the information relevant to the problem is kept
- So the problem is simpler to solve, or the solution needs less storage or processing
Model answer. Abstraction means removing or hiding the detail that is not needed to solve a particular problem, so that only the information that is genuinely relevant remains. It is used because a problem with less detail in it is easier to understand and quicker to design a solution for, and because the resulting program stores and processes less data, so it runs faster and uses less memory.
4 A weather app models rainfall across a country. Describe two details the developers would keep and two they would remove, and justify your choices. 4
One mark for each of the following, to a maximum of 4.
- Names a relevant detail that is kept, such as location, rainfall amount, time or temperature
- Justifies keeping it because it affects the forecast or the output the user needs
- Names an irrelevant detail that is removed, such as building colours, street names or the shape of individual clouds
- Justifies removing it because it does not change the result and would waste storage or processing
Model answer. The developers would keep the location of each measurement and the amount of rain recorded there, because the whole purpose of the app is to tell a user how much rain is expected at a place, so neither can be removed without breaking the app. They would also keep the time of each reading, since a forecast is meaningless without knowing when it applies. They would remove details such as the colour of the buildings in each town and the exact shape of individual clouds, because neither changes the rainfall figure a user is shown. Storing and processing that extra detail would use more memory and slow the forecast calculation down for no benefit at all.
5 Compare decomposition and abstraction, making clear how they differ. 4
One mark for each of the following, to a maximum of 4.
- Decomposition splits a problem into smaller sub problems
- Abstraction removes or hides detail that is not needed
- Both reduce the complexity the programmer has to deal with at once
- They are usually used together, with a problem first broken up and detail then removed from each part
Model answer. Decomposition and abstraction are both ways of making a large problem manageable, but they act on it differently. Decomposition splits the problem into smaller sub problems, so a library system becomes separate tasks for issuing books, returning books and calculating fines. Abstraction does not split anything: it removes detail from the problem, so the book record keeps the title, author and ISBN but not the colour of the cover. What they share is that each reduces how much a programmer has to hold in mind at one time, which makes the solution quicker to design and easier to test. In practice they are used together, because a problem is normally decomposed into parts first and then unnecessary detail is stripped out of each part.