2 An algorithm is expressed as follows: • input 100 numbers, one at a time • keep a total of all numbers input that have a value between 30 and 70 inclusive and output this total after the last number has been input. Outline, using stepwise refinement, the five steps for this algorithm which could be used to produce pseudocode. Do not use pseudocode statements in your answer.
- (a)Step 1 Step 2 Step 3 Step 4 Step 5[5]
- (b)Sequence is one programming construct. Identify two other programming constructs that will be required when the algorithm is converted into pseudocode. Construct 1 Construct 2[2]
Mark scheme
Marking points from the official mark scheme (Oct/Nov 2023). The mark or mark type is shown in brackets.
- [1] Set total to zero
- [1] Input a number
- [1] Check if number greater than 29 and less than 71
- [1] if check is true - add number to total
- [1] Repeat from step 2 99 times / for a total of 100 iterations
- [1] Output the total
- [1] An iterative construct / a (count-controlled) loop
- [1] A selection construct / an IF statement
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 →