Complete the trace table for the algorithm shown in Figure 9 - AQA - GCSE Computer Science - Question 10 - 2023 - Paper 1
Question 10
Complete the trace table for the algorithm shown in Figure 9.
You may not need to use all the rows in the table.
| count | i | person | j | result |
|-------|---|-... show full transcript
Worked Solution & Example Answer:Complete the trace table for the algorithm shown in Figure 9 - 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
The trace table for the algorithm in Figure 9 can be completed as follows:
count
i
person
j
result
0
0
Natalie
0
78
1
0
Natalie
1
81
2
1
Alex
0
27
3
1
Alex
1
51
4
2
Roshana
0
55
5
2
Roshana
1
59
Step 2
How could the error in the algorithm in Figure 9 be corrected?
99%
104 rated
Only available for registered users.
Sign up now to view full answer, or log in if you already have an account!
Answer
The correct option to fix the error in the algorithm in Figure 9 is:
D: Change line number 9 to: result ← scores[j * 3 + i]
This correction addresses the indexing logic for accessing the scores, ensuring the correct scores are calculated based on the current person and iteration.