Skip to content
MathsGenie logo
Open app

Course home

  1. GCSE
  2. Computer Science AQA
  3. Question bank

Programming concepts

EasyMediumHard
12345678910111213141516171819202122232425262728293031323334353637383940
Question 26

A 4x4 game board tracks the coordinates of a hidden item marked with the character 'T'. The rest of the board contains empty values marked with 'E' as shown in the grid below.

Grid Layout

Col 0Col 1Col 2Col 3
Row 0EEEE
Row 1EETE
Row 2EEEE
Row 3EEEE

Program Code

for r in range(4):
    for c in range(4):
        if checkCell(r, c) == "T":
            target_r = r
            target_c = c

Explain the purpose of the first iteration structure (for r in range(4)) in this program.

[1]

Programming concepts Questions

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