Question PSC-ARR-0011
MediumWhat will be the output of the following pseudocode?
Integer a[] = {3, 1, 4, 1, 5, 9, 2, 6}
Integer f = a[0], s = -1
for (each i from 1 to 7)
if (a[i] > f)
s = f
f = a[i]
else if (a[i] > s AND a[i] != f)
s = a[i]
end if
end for
Print s
- A.
4
- B.
9
- C.
Sign up free to see the answer and a step-by-step explanation.