AQA GCSE Computer Science Paper 1 (1C), June 2025: Question 9
2 marks · Medium difficulty · Multiple Choice
Determine whether each of five pseudo-code algorithms correctly calculates the sum of the five values in an array.
Practise this questionQuestion
Question text
09 Figure 9 shows five algorithms, represented using pseudo-code.
Figure 9
numbers [44, 1, 2, 14, 68]
counter 0
total 0
WHILE counter < 5
A index counter
total total + numbers[index]
counter counter + 1
ENDWHILE
OUTPUT total
numbers [44, 1, 2, 14, 68]
total 0
FOR a 0 TO LEN(numbers) - 1
B
total total + numbers[a]
ENDFOR
OUTPUT total
numbers [44, 1, 2, 14, 68]
total 0
FOR a 1 TO 7
C
total total + numbers[a]
ENDFOR
OUTPUT total
numbers [44, 1, 2, 14, 68]
total 0
WHILE total > 0
D
total total + numbers[total]
ENDWHILE
OUTPUT total
numbers [44, 1, 2, 14, 68]
total 0
x 1
E REPEAT
total total + numbers[x]
UNTIL x = 5
OUTPUT total25
The algorithms in Figure 9 have been written to calculate the total of the five values
in the array numbers. Not all of the algorithms work.
Complete the table by ticking ( ) one box in each column (A–E).
[2 marks]
Algorithm
*24* A B C D E
Algorithm totals the five values
Algorithm does not total the five values
Mark scheme
Show the mark scheme
Total
Question Part Marking guidance
marks
09 2 marks for (AO2 apply) 2
MP1: for any three columns correct;
MP2: for all columns correct;
A B C D E
Algorithm totals the five values ✔ ✔
Algorithm does not total the five values ✔ ✔ ✔
R. column if more than 1 tick in that column
How to answer it
Algorithm Tracing: Iterating & Totaling Array Values
This question assesses your ability to trace pseudo-code and evaluate whether iteration constructs (loops) correctly traverse a 1D array. You must know:
- 0-based array indexing: An array with 5 elements has valid indices 0, 1, 2, 3, and 4.
- Loop boundaries: How WHILE , FOR , and REPEAT...UNTIL control variable updates.
- Running totals: Correct accumulator pattern ( total ← total + numbers[index] ).
Question 09: Evaluating Algorithms A to E
Totaling the 5 elements in numbers ← [44, 1, 2, 14, 68]
✅ Correct Answer (Completed Table)
| Outcome | A | B | C | D | E |
|---|---|---|---|---|---|
| Algorithm totals the five values | ✓ | ✓ | |||
| Algorithm does not total the five values | ✓ | ✓ | ✓ |
• 1 mark (MP1): Any 3 columns ticked correctly.
• 2 marks (MP2): All 5 columns ticked correctly.
Note: Reject a column if more than one tick is placed in it.
📐 Step-by-Step Algorithm Analysis
- A (Works ✓): counter starts at 0 . The loop runs while counter < 5 , incrementing by 1 each time. It accesses indices 0, 1, 2, 3, 4. All 5 values are summed accurately.
- B (Works ✓): LEN(numbers) is 5, so LEN(numbers) - 1 equals 4. The loop iterates variable a from 0 TO 4 inclusive, correctly accessing all five elements.
- C (Fails ✗): Starts loop at a ← 1 TO 7 . Misses the first element ( numbers[0] ) and tries to read indices 5, 6, and 7 which do not exist (causes an "Index Out of Range" error).
- D (Fails ✗): Condition is WHILE total > 0 , but total was initialized to 0 ! The condition 0 > 0 is false immediately, so the loop never executes.
- E (Fails ✗): Two major bugs: x starts at 1 (misses index 0), and x is never incremented inside the loop! This creates an infinite loop constantly adding numbers[1] .
💡 Key Knowledge: 0-Based Indexing
In AQA pseudo-code arrays, positions are indexed starting at 0:
- numbers[0] = 44 (First item)
- numbers[1] = 1
- numbers[2] = 2
- numbers[3] = 14
- numbers[4] = 68 (Last item)
Therefore, a loop totaling an array of length N must iterate from 0 to N - 1.
🧠 Exam Technique: How to Check Quickly
- Check initialization: Look at initial values for loop counters and accumulators ( total ← 0 ).
- Check loop entry: Does the condition actually allow the loop to start? (Notice how algorithm D failed instantly).
- Check counter increment: Does the loop index advance on every iteration? (Notice algorithm E never increments x ).
- Check start & end bounds: Does it start at 0 and finish at 4?
❌ Common Errors & Misconceptions
- Assuming 1-based indexing: Thinking that algorithms starting at 1 (like C and E) are correct. In computer science, arrays typically start at index 0.
- Overlooking loop conditions: Assuming that because algorithm D has code inside the loop, it will run. Always check entry conditions first!
- Forgetting infinite loops: Assuming a REPEAT...UNTIL loop works without checking if the condition variable ever changes inside the loop body.
Topics
3.1 Fundamentals of algorithms · 3.2 Programming · 3.1.1 Representing algorithms · 3.2.2 Programming concepts · 3.2.6 Data structures
Question and mark scheme from the AQA GCSE Computer Science examination, Paper 1 (1C), June 2025. QuestionVault is an independent revision resource; questions remain the copyright of the awarding body.