Question PSC-ARR-0056
MediumWhat does the following pseudocode print?
Integer a[6] = {5, 3, 5, 1, 3, 5}
Integer i, j, c, best = 0, val
for (each i from 0 to 5)
c = 0
for (each j from 0 to 5)
if (a[j] == a[i]) c = c + 1
end for
if (c > best)
best = c
val = a[i]
end if
end for
Print val, best
- A.
3 2
- B.
1 1
- C.
Sign up free to see the answer and a step-by-step explanation.