Computer Science · May / June 2023 · Paper 22 · Question 4
0478
As printed in the paper
The question as text
A program needs to make sure the value input for a measurement meets the following rules: • the value is a positive number • a value is always input • the value is less than 1000.
Read automatically from the paper; the printed page above is exact.
Show the answer and mark scheme
4(a)[3]
One mark for each point (max three).
range check with acceptable values is (greater than) zero and less than 1000presence check to ensure the program will not continue until a value has been enteredtype/character check to ensure that a number is enteredlength check to ensure there are no more than 3 digits entered4(b)(i)[1]
To verify the data / for verification / as a verification check // to make sure that no changes are made to the data on entry
4(b)(ii)[3]
One mark for each point (max three).
use of iterationuse of two inputsto check that the two inputs are the same / differentuse of the given variable MeasurementFor example
REPEAT
OUTPUT "Please enter measurement "
INPUT Measurement
OUTPUT "Please re-enter measurement "
INPUT MeasurementCheck
UNTIL Measurement = MeasurementCheck
Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.

