Question PSC-ARR-0008
MediumWhat will be the output of the following pseudocode?
Integer a[] = {1, 2, 3, 4, 5}
for (each i from 0 to 1)
Integer t = a[i]
a[i] = a[4 - i]
a[4 - i] = t
end for
Print a[0], a[1], a[2], a[3], a[4]
- A.
5 2 3 4 1
- B.
2 1 3 5 4
- C.
5 4 3 2 1
- D.
1 2 3 4 5
Sign up free to see the answer and a step-by-step explanation.