Cambridge O Level Computer Science 2210 · 7.7 Trace tables

Q57 · 2210/22/O/N/23 Q6

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

Q572210/22/O/N/23original Q6Structured · 7 marks
Question 6 from 2210/22/O/N/23

Worked solution

(a)

Follow the flowchart one box at a time. Total and Count are set to 0 at the start of every group. A value of 0 ends a group: work out the average, output the total and average, then start again. A value of -1 stops the algorithm.

ValueAverageTotalCountOUTPUT
00
25251
35602
3633
021Total is 63
Average is 21
00
57571
20772
251023
181204
030Total is 120
Average is 30
00
-1

Value column correct [1]

Average column correct [1]

Total column correct [1]

Count column correct [1]

OUTPUT column correct [1]

(b)

Write any two of these:

The algorithm adds together a group (batch) of numbers and finds their average [1]

The total and average are output when a 0 is entered, which ends the group [1]

A new group is started after each 0, so the algorithm works on several groups until -1 is entered (this point also scores)

KEY IDEAA trace table follows the flowchart one box at a time and resets the totals whenever a new group starts.
TOTAL 7 marks

Official mark scheme

Mark scheme for 2210/22/O/N/23 question 6
VIDEO
▶ Whole paper

Video solution of the whole paper · by Paper solver.. 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.