2210/22/M/J/23 question 4: worked solution (May/June 2023, paper 22)

Show as plain text

Cambridge O Level Computer Science 2210 · 7.5 Validation and verification checks Worked solution from the Algorithm design and problem-solving Paper 2 Algorithms, Programming and Logic booklet, Part 4 of 8. Q24 2210/22/M/J/23 original Q4 Structured · 7 marks Worked solution (a) Match one check to each rule. Any three of these: Range check : the value must be greater than 0 and less than 1000 [1] Presence check : a value must be entered, so the program cannot go on with an empty input [1] Type check (character check): make sure a number is entered, not letters [1] A length check also scores: no more than 3 digits are entered. (b)(i) Write: it is a verification check, to make sure the data has not changed or been mistyped when it was entered [1] (b)(ii) Use a loop that asks for the value twice and repeats until both inputs match. REPEAT OUTPUT "Please enter measurement " INPUT Measurement OUTPUT "Please re-enter measurement " INPUT MeasurementCheck UNTIL Measurement = MeasurementCheck Iteration used (REPEAT ... UNTIL or any working loop) [1] Two inputs, one stored in the variable Measurement [1] The loop ends only when the two inputs are compared and are the same [1] KEY IDEA Validation checks that data is sensible; verification (double entry) checks that it was entered correctly. TOTAL 7 marks Official mark scheme VIDEO ▶ Whole paper Video solution of the whole paper · by CS BY AQIB KHAN. Tap the picture to open it on YouTube.