Cambridge O Level Computer Science 2210 · 8.1 Programming concepts

Q22 · 2210/22/O/N/23 Q3

Worked solution from the Programming Paper 2 Algorithms, Programming and Logic booklet, Part 1 of 3.

Q222210/22/O/N/23original Q3Structured · 8 marks
Question 3 from 2210/22/O/N/23

Worked solution

(a)

Draw these four lines:

CALL Colour(NewColour) → using a procedure [1]

Value ← (A1 + A2 + A3) / 3 → finding an average [1]

Loop1 ← Loop1 + 1 → counting [1]

IF Count > 7 THEN X1 ← 0 → using a conditional statement [1]

Totalling is not needed.

(b)

Start the lowest value high, then check each of the 25 elements and keep the smaller one.

Min ← 100
FOR Count ← 1 TO 25
    IF Temperatures[Count] < Min
        THEN
            Min ← Temperatures[Count]
    ENDIF
NEXT Count
OUTPUT "The lowest temperature is ", Min

Lowest value set to a high value (at least 100) or the first element before the loop [1]

Loop that runs 25 times [1]

IF checks whether the element is less than the current lowest, and if so stores it as the lowest [1]

Result output once, after the loop, with a message [1]

KEY IDEAStart with a very high lowest value, compare every element inside one loop and output only after the loop.
TOTAL 8 marks

Official mark scheme

Mark scheme for 2210/22/O/N/23 question 3
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.