Skip to content

Course home

Programming concepts

Programming concepts

EasyMediumHard
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
Question 68

A drone is programmed to scan an ecological reserve to locate the nesting site of an endangered species. The reserve is partitioned into a grid with 5 sections (rows) and 6 zones (columns).

Figure 1 shows a segment of the control program used to identify the coordinate of the nesting site.

Figure 1

nest_section = -1
nest_zone = -1
for s in range(0, 5):
    for z in range(0, 6):
        if check_habitat(s, z) == "Eagle Nest":
            nest_section = s
            nest_zone = z

Figure 2 shows an example layout of the monitored reserve grid.

Figure 2

Zone 0Zone 1Zone 2Zone 3Zone 4Zone 5
Section 0EmptyEmptyEmptyEmptyEmptyEmpty
Section 1EmptyEmptyEmptyEmptyEmptyEmpty
Section 2EmptyEmptyEmptyEagle NestEmptyEmpty
Section 3EmptyEmptyEmptyEmptyEmptyEmpty
Section 4EmptyEmptyEmptyEmptyEmptyEmpty

Explain the purpose of the first iteration structure (the outer loop) in the program in Figure 1.

[1]
Markscheme

Programming concepts Questions

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

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.

Question bank