Computer Science · Oct / Nov 2016 · Paper 23 · Question 2
2210
As printed in the paper
The question as text
Read this section of program code that: • inputs 10 numbers • checks whether each number is within a specified range • totals the numbers within the range and outside the range 1 InRange = 0 2 OutRange = 1000 3 FOR Count = 1 TO 10 4 INPUT Num 5 IF Num > 10 AND Num < 20 THEN InRange = InRange + 1 6 ELSE OutRange = OutRange - 1 7 Count = Count + 1 8 NEXT X 9 PRINT InRange, OutRange
Read automatically from the paper; the printed page above is exact.
Show the answer and mark scheme
2(a)[4]
1 mark for each change – Line 2: OutRange = 0 – Line 6: should be OutRange = OutRange + 1 – Line 7: not needed – Line 8: NEXT X should be NEXT Count / Line 3: FOR Count = 1 TO 10 should be FOR X = 1 TO 10 [4]
2(b)[4]
Number Within range (9)
Outside range (9)
Reason 10 9 Range greater than 10, so 10 not included ………………………………………………………… 20 9 Range less than 20, so 20 not included ………………………………………………………… [4]
Make a free account to save your answers and see your weak topics and ask the AI why a wrong answer is wrong.

