Which two of the following statements about the program in Figure 1 are true when it is used with the grid in Figure 2?
Figure 1: Program Code
row_target = -1
col_target = -1
for r in range(0, 3):
for c in range(0, 3):
if getVal(r, c) == 9:
row_target = r
col_target = c
Figure 2: Grid Values (3x3 grid representing sensor strength)
| Column 0 | Column 1 | Column 2 | |
|---|---|---|---|
| Row 0 | 1 | 4 | 2 |
| Row 1 | 3 | 9 | 1 |
| Row 2 | 2 | 5 | 0 |
Select two options:
row_target will be 2.getVal(r, c) == 9 is executed nine times.for r in range(0, 3), executes its block nine times.r and c never change during the execution of the program.298 exam-style questions on AQA GCSE Computer Science Programming concepts. Each one has a worked solution and a mark scheme showing where the marks go.