Skip to content

Course home

Algorithms

Algorithms

EasyMedium
123456789101112131415161718192021222324252627
Question 10

A programmer is writing an algorithm to sort an array of exam scores in ascending order. Below is a section of the pseudocode used to swap two elements in the array scores:

IF scores[index] > scores[index + 1] THEN
    temp = scores[index]
    scores[index] = scores[index + 1]
    scores[index + 1] = temp
ENDIF

Explain why the variable temp is needed in this algorithm.

[2]
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