19Medium
0/2

Which two of the following statements about the Python program in Figure 1 are true when it is executed with the grid shown in Figure 2?

Select two options.

Figure 1

for r in range(4):
    for c in range(3):
        if getValue(r, c) == 12:
            found_row = r
            found_col = c

Figure 2

column 0column 1column 2
row 0385
row 114129
row 21227
row 311610
  • A: The outer loop for r in range(4) executes exactly 4 times.
  • B: The final value of found_col will be 0.
  • C: The assignment found_row = r will run for every cell in the grid.
  • D: The total number of comparisons between getValue(r, c) and 12 is 8.
  • E: The inner loop variable c remains constant throughout the execution of the program.
[2]

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