Login or Create an Account to view the mark scheme, comment, and add to a test
Given the following array called CITIES
[2]CITIES = [Cairo, Athens, Melbourne, Mumbai, Beijing]
Trace the following algorithm to show the contents of CITIES immediately after each iteration of the loop and state the number of times the loop is executed
N = 4
i = 1
loop while i - 1 < N
TEMP = CITIES[ i - 1 ]
CITIES[ i - 1 ] = CITIES[ N - i + 1]
CITIES[ N - i + 1 ] = TEMP
i = i + 1
end loop
Short Answer2 MarksPremium
38 Uses109 Views3 Likes