Describe the purpose of each statement in this algorithm. ``` FOR I <- 1 TO 300 INPUT Name [I] NEXT I ```
- (a)Describe the purpose of each statement in this algorithm. ``` FOR I <- 1 TO 300 INPUT Name [I] NEXT I ```[2]
- (b)Identify, using pseudocode, another loop structure that the algorithm in part (a) could have used.[1]
- (c)Write an algorithm, using pseudocode, to input a number between 0 and 100 inclusive. The algorithm should prompt for the input and output an error message if the number is outside this range.[3]
Mark scheme
Marking points from the official mark scheme (May/June 2017). The mark or mark type is shown in brackets.
- [2] Any two from:
- - Loop with 300 repetitions (starting at 1) / Loops from 1 to 300
- - Values input/stored (in consecutive/different locations) in an array (at position I)
- - Increases the loop counter/I value by 1 (and returns to the start of the loop)
- [1] Any one from:
- - REPEAT (... UNTIL)
- - WHILE (... DO ... ENDWHILE)
- [1] Prompt and input number
- [1] Checking the input number is between 0 and 100 - both limits
- [1] Correct error message
- Many correct algorithms. This is an example only.
- OUTPUT "Enter a number between 0 and 100 "
- INPUT Number
- IF Number < 0 OR Number > 100
- THEN
- OUTPUT "The number you have entered is outside the specified range"
- ENDIF
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 →