Skip to content
MathsGenie logo
Open app

Course home

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

Programming concepts

EasyMediumHard
12345678910111213141516171819202122232425262728293031323334353637383940
Question 32

An algorithm is shown in Figure 1.

1  items <- ["Apple", "Banana", "Cherry", "Date"]
2  itemFound <- false
3  index <- 0
4  target <- "Cherry"
5  WHILE index < 4 AND itemFound = false
6      IF items[index] = target THEN
7          itemFound <- true
8      ELSE
9          index <- index + 1
10     ENDIF
11 ENDWHILE

Figure 1

Explain why using the identifier itemFound is a better choice of variable name than using the single-letter identifier f.

[2]

Programming concepts Questions

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