Worked solution from the Data Types and Structures Paper 2 Problem-solving and Programming booklet, Part 2 of 4.
Write any three benefits:
Library routines are tried and tested, so they are free from errors [1]
They do a job you may not be able to program yourself, for example encryption [1]
They are readily available and so speed up development time [1]
Write three points:
With arrays the data can be processed, searched or sorted easily, using a loop and an index [1]
The program is easier to design, write, test and understand [1]
Many values are held under one identifier, so far fewer variables are needed, and it is easier to change when the number of students grows [1]
Purpose: it holds the index that points to one element of the arrays [1]
Data type: INTEGER [1]
State one error for each statement:
| Statement | Error |
|---|---|
| IF EMPTY ← "" THEN | Should be = (comparison), not ← (assignment) |
| Status ← IS_NUM(-23.4) | The parameter must be a string (or char), not a real number |
| X ← STR_TO_NUM("37") + 5 | NO ERROR |
| Y ← STR_TO_NUM("37" + "5") | Wrong operator: strings are joined with &, not + |
First row correct [1]
Second row correct [1]
Third row correct [1]
Fourth row correct [1]
▶ Whole paper
Video solution of the whole paper · by Pseudocode Pro. Tap the picture to open it on YouTube.
Solutions follow the official Cambridge mark schemes; marks are shown in grey. Videos are from other YouTube channels. Paper codes read component / series / year: M/J = May/June, O/N = October/November. Past-paper questions © UCLES, reproduced for classroom practice.