Cambridge O Level Computer Science 2210 · 7.8 Identifying and correcting errors in algorithms

Q77 · 2210/21/M/J/25 Q10

Worked solution from the Algorithm design and problem-solving Paper 2 Algorithms, Programming and Logic booklet, Part 7 of 8.

Q772210/21/M/J/25original Q10Structured · 7 marks
Question 10 from 2210/21/M/J/25

Worked solution

(a)

Follow each score through the flowchart. A score of 40 or more takes the first Yes, so it gets C. Only scores below 40 reach the other tests, so they get D. The other tests are never reached for 63 and 91.

ScoreGradeOUTPUT
21DYou achieved a D
46CYou achieved a C
63CYou achieved a C
91CYou achieved a C
12DYou achieved a D

Score column correct [1]

Grade column correct [1]

OUTPUT column correct [1]

All three marks can be given if only the first row is correct.

(b)

The decisions are in the wrong order, so the tests must be reversed. Write these changes:

Change the first decision to IS Score >= 80 ? [1]

Change the last decision to IS Score >= 40 ? [1]

Change the process box after the first decision from Grade ← "C" to Grade ← "A" [1]

Change the process box after the last decision from Grade ← "A" to Grade ← "C" [1]

Other accepted changes: add a loop (an output asking for a score or -1 to stop, a counter, a decision box with an exit condition and correct arrows).

KEY IDEATests must go from the highest boundary to the lowest, otherwise a high score is caught by the first, lowest test.
TOTAL 7 marks

Official mark scheme

Mark scheme for 2210/21/M/J/25 question 10
VIDEO
▶ Topic lesson

A lesson on this topic · by Mr Bulmer's Learning Zone. 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.