Cambridge O Level Computer Science 2210 · 7.7 Trace tables

Q49 · 2210/21/M/J/21 Q5

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

Q492210/21/M/J/21original Q5Structured · 6 marks
Question 5 from 2210/21/M/J/21

Worked solution

(a)

Run the flowchart for each input. Reject if the value is not from 50 to 100. If it is, Diff1 = 100 - Value and Diff2 = Value - 50. If either difference is less than 1 the output is Extreme, otherwise Normal. The algorithm stops at -1.

ValueDiff1Diff2OUTPUT
50500Accept: Extreme
752525Accept: Normal
99149Accept: Normal
28Reject: Abnormal
821832Accept: Normal
150Reject: Abnormal
-1

Value column correct [1]

Diff1 column correct [1]

Diff2 column correct [1]

OUTPUT column correct [1]

The data after -1 (672 and 80) is never read.

(b)

Write two of these:

It outputs the type of test data (normal, extreme or abnormal) [1]

It does this with a range check, testing if the number is from 50 to 100 inclusive [1]

KEY IDEAA range check can sort test data into normal, extreme (on the limits) and abnormal (outside the limits).
TOTAL 6 marks

Official mark scheme

Mark scheme for 2210/21/M/J/21 question 5
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.