Skip to content
MathsGenie logo
Open app

Course home

  1. IGCSE
  2. Computer Science Edexcel
  3. Question bank

Algorithms

EasyMedium
123456789101112131415161718192021222324252627
Question 27

An algorithm is shown in Figure 1.

Figure 1

1 SET originalList TO ["North", "East", "South", "West"]
2 SET reversedList TO ["", "", "", ""]
3 SET writePos TO 0
4
5 FOR readPos FROM (LENGTH(originalList) - 1) TO 0 STEP -1 DO
6     SET reversedList[writePos] TO originalList[readPos]
7     SET writePos TO writePos + 1
8 END FOR

State the purpose of the algorithm in Figure 1.

[1]

Algorithms Questions

  1. IGCSE
  2. /Computer Science
  3. /Algorithms