Cambridge O Level Computer Science 2210 · 7.5 Validation and verification checks

Q34 · 2210/22/M/J/25 Q4

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

Q342210/22/M/J/25original Q4Structured · 7 marks
Question 4 from 2210/22/M/J/25

Worked solution

(a)

Write that a verification check makes sure the data was entered correctly:

To check that the value entered has not changed or been mistyped on input (it matches the original) [1]

(b)

Use one loop to input the numbers and a second loop to input them again and compare. One correct answer:

FOR Index ← 1 TO 10
    INPUT Numbers[Index]
NEXT Index
FOR Index ← 1 TO 10
    INPUT CheckNumber
    IF CheckNumber <> Numbers[Index]
      THEN
        OUTPUT CheckNumber, " and ", Numbers[Index], " do not match. Please re-enter the number."
        INPUT Numbers[Index]
    ENDIF
NEXT Index
OUTPUT "The check has been completed."

At least one appropriate working loop [1]

First inputs of all 10 numbers stored in Numbers[] [1]

Correct second input made for each number [1]

Working selection statement that compares the first and second inputs one at a time [1]

If they do not match, output both values and a message asking for re-entry [1]

New input stored in the current array location, replacing the old one [1]

A final message after the loops saying the check is completed is also a mark point, but the question is marked out of 6.

KEY IDEADouble entry means typing the data twice and comparing the two entries.
TOTAL 7 marks

Official mark scheme

Mark scheme for 2210/22/M/J/25 question 4
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.