2210/22/O/N/23 question 6: worked solution (October/November 2023, paper 22)
Show as plain textHide plain text
Cambridge O Level Computer Science 2210 · 7.7 Trace tables Worked solution from the Algorithm design and problem-solving Paper 2 Algorithms, Programming and Logic booklet, Part 6 of 8. Q57 2210/22/O/N/23 original Q6 Structured · 7 marks 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. Value Average Total Count OUTPUT 0 0 25 25 1 35 60 2 3 63 3 0 21 Total is 63 Average is 21 0 0 57 57 1 20 77 2 25 102 3 18 120 4 0 30 Total is 120 Average is 30 0 0 -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 IDEA A 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 VIDEO ▶ Whole paper Video solution of the whole paper · by Paper solver.. Tap the picture to open it on YouTube.