Figure 9 shows an algorithm, represented in pseudo-code, to display students' test scores - AQA - GCSE Computer Science - Question 10 - 2023 - Paper 1
Question 10
Figure 9 shows an algorithm, represented in pseudo-code, to display students' test scores. The algorithm does not work as expected and the teacher wants to find the ... show full transcript
Worked Solution & Example Answer:Figure 9 shows an algorithm, represented in pseudo-code, to display students' test scores - AQA - GCSE Computer Science - Question 10 - 2023 - Paper 1
Step 1
Complete the trace table for the algorithm shown in Figure 9
96%
114 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
Trace Table Completion
count
i
person
j
result
0
0
Natalie
0
78
1
0
Natalie
1
81
2
0
Natalie
2
72
3
1
Alex
0
27
4
1
Alex
1
51
5
1
Alex
2
54
6
2
Roshana
0
52
7
2
Roshana
1
55
8
2
Roshana
2
59
Correction to the Error
To correct the algorithm in Figure 9, the appropriate change would be:
D Change line number 10 to: result ← scores[j * 3 + i].
This will ensure that the correct scores are being accessed based on the current index.