2210/22/O/N/20 question 4: worked solution (October/November 2020, paper 22)
Show as plain textHide plain text
Cambridge O Level Computer Science 2210 · 7.9 Writing and amending algorithms Worked solution from the Algorithm design and problem-solving Paper 2 Algorithms, Programming and Logic booklet, Part 8 of 8. Q84 2210/22/O/N/20 original Q4 Structured · 6 marks Worked solution Set Higher to 0 before the loop, test each number as it is input, and output Higher once after the loop. Higher ← 0 FOR Count ← 1 TO 5000 INPUT Number[Count] IF Number[Count] > 500 THEN Higher ← Higher + 1 ENDIF NEXT Count OUTPUT "There are ", Higher, " values that are greater than 500" Higher set to 0 before the loop [1] An IF statement used [1] Correct condition in the IF (Number[Count] > 500) [1] Correct counting statement inside the loop [1] OUTPUT with a correct reference to Higher, after the loop [1] An appropriate message in the output [1] KEY IDEA Initialise a counter before the loop, add to it inside the loop when the test is true, and output it after the loop. TOTAL 6 marks Official mark scheme VIDEO ▶ Whole paper Video solution of the whole paper · by Quixotic Academy. Tap the picture to open it on YouTube.