Question PSC-ARR-0015
HardWhat will be the output of the following pseudocode?
Integer a[] = {0, 1, 0, 3, 12}
Integer k = 0
for (each i from 0 to 4)
if (a[i] != 0)
a[k] = a[i]
k = k + 1
end if
end for
for (each i from k to 4)
a[i] = 0
end for
Print a[0], a[1], a[2], a[3], a[4]
- A.
1 3 12 0 0
- B.
12 3 1 0 0
- C.
Sign up free to see the answer and a step-by-step explanation.