This section of program code may be used as a validation check. 1 PRINT "Input a value between 0 and 100 inclusive" 2 INPUT Value 3 WHILE Value < 0 OR Value > 100 4 PRINT "Invalid value, try again" 5 INPUT Value 6 ENDWHILE 7 PRINT "Accepted: ", Value
- (a)Give a name for this type of validation check.[1]
- (b)Describe what is happening in this validation check.[2]
- (c)Complete the trace table for this program code using the test data: 200, 300, −1, 50, 60 Value OUTPUT[3]
- (d)Draw a flowchart to represent this section of program code.[5]
This question uses a diagram from the original paper, which isn't shown here. Open the full paper from the past papers archive to see it.
Mark scheme
Marking points from the official mark scheme (May/June 2019). The mark or mark type is shown in brackets.
- [1] Range check
- [2] Two from: • The entered number (Value) is being checked to see that it is not < 0 or not > 100 • If it is, it is rejected and the user has to enter another number / an error message is displayed • Otherwise the number is accepted, the word 'Accepted' is output along with the Value
- [3] 1 mark - Value column 1 mark - OUTPUT column first line 1 mark - OUTPUT column lines two to five Value OUTPUT Input a value between 0 and 100 inclusive 200 Invalid value, try again 300 Invalid value, try again -1 Invalid value, try again 50 Accepted: 50
- [5] 1 mark - Input prompt and input value 1 mark - Correct decision box labelled sufficiently (Yes/No) – allow 2 decision boxes 1 mark - Remaining outputs correct 1 mark - All connecting lines and arrows to be complete and correct 1 mark - Standard flowchart symbols used
Write your answer and get it marked
On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.
Sign up free →