A sensor array tracks temperatures across a regional grid. The grid is represented by a 2D array, thermal_map, with 4 rows and 3 columns. The current temperature readings (in ∘C^\circ\text{C}∘C) are shown in the table below:
| Row \ Column | 0 | 1 | 2 |
|---|---|---|---|
| 0 | 23 | 41 | 18 |
| 1 | 46 | 32 | 45 |
| 2 | 19 | 24 | 15 |
| 3 | 45 | 12 | 30 |
The following algorithm is used to locate thermal anomalies (temperatures of 45∘C45^\circ\text{C}45∘C or higher):
max_row = -1
max_col = -1
for r from 0 to 3
for c from 0 to 2
if get_temp(r, c) >= 45 then
max_row = r
max_col = c
endif
endfor
endfor
Which of the following statements about the execution of this algorithm is correct?
The final value of the variable max_col is 222.
The outer loop's block (the inner loop) is executed a total of 121212 times.
The conditional expression get_temp(r, c) >= 45 is evaluated exactly 121212 times.
The assignment statements inside the if block are executed exactly 222 times.
Practise AQA GCSE Computer Science Programming concepts with exam-style questions for GCSE Computer Science. 100 questions, matched to the AQA GCSE Computer Science (8525) specification and written in Paper 1 and Paper 2 style. Every question includes a full worked solution and mark scheme, so you can see where marks are awarded rather than just whether you got the answer right.