Skip to content
MathsGenie logo
Open app

Course home

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

Algorithms

EasyMedium
123456789101112131415161718
Question 1

An algorithm is designed to reverse the order of elements in an array.

Scores = [15, 3, 9, 7, 18]
Count = 0
Size = 4
Limit = 2
Temp = 0

WHILE Count < Limit
    Temp = Scores[Count]
    Scores[Count] = Scores[Size - Count]
    Scores[Size - Count] = Temp
    Count = Count + 1
ENDWHILE

Complete the trace table below for this algorithm. You may not need to use all of the empty rows.

CountSizeLimitTempScores[0]Scores[1]Scores[2]Scores[3]Scores[4]
04201539718
[5]

Algorithms Questions

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