A program is designed to manage bookings in a restaurant. The seating layout is organized into 4 rows and 6 columns of tables.
Figure 1 shows a section of the program used to identify the location of a VIP table.
Figure 1
target_row = -1
target_col = -1
for r in range(0, 4):
for c in range(0, 6):
if get_table_type(r, c) == "VIP":
target_row = r
target_col = c
Figure 2 shows an example layout of the restaurant tables.
Figure 2
| Column 0 | Column 1 | Column 2 | Column 3 | Column 4 | Column 5 | |
|---|---|---|---|---|---|---|
| Row 0 | Standard | Standard | Standard | Standard | Standard | Standard |
| Row 1 | Standard | Standard | VIP | Standard | Standard | Standard |
| Row 2 | Standard | Standard | Standard | Standard | Standard | Standard |
| Row 3 | Standard | Standard | Standard | Standard | Standard | Standard |
Explain the purpose of the first iteration structure (the outer loop) in the program in Figure 1.
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.