Question PSC-ARR-0068
HardWhat does the following pseudocode print?
Integer a[8] = {0, 1, 1, 0, 1, 1, 1, 0}
Integer i, cur = 0, best = 0
for (each i from 0 to 7)
if (a[i] == 1)
cur = cur + 1
if (cur > best) best = cur end if
else
cur = 0
end if
end for
Print best
- A.
2
- B.
4
- C.
Sign up free to see the answer and a step-by-step explanation.