39Easy
0/1

A marine biologist is writing a program to locate the coordinate position of a microplastic pollution hotspot (defined as a concentration greater than 15 particles per litre) on a 4x4 monitoring grid.

Figure 1

hotspot_row = -1
hotspot_col = -1
for row_idx in range(0, 4):
    for col_idx in range(0, 4):
        if get_concentration(row_idx, col_idx) > 15:
            hotspot_row = row_idx
            hotspot_col = col_idx

Figure 2

Column 0Column 1Column 2Column 3
Row 038124
Row 1714192
Row 2511913
Row 361081

Explain the purpose of the first iteration structure (the loop with control variable row_idx) in Figure 1.

[1]

Programming concepts Questions

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.

PreviousNext

Programming concepts Questions

  1. GCSE
  2. /Computer Science
  3. /Programming concepts