Skip to content

Course home

Algorithms

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]
Markscheme

Algorithms Questions

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

45 exam-style questions on Edexcel IGCSE Computer Science Algorithms. Each one has a worked solution and a mark scheme showing where the marks go.

Question bank