Question PSC-BIT-0067
HardWhat is the output of this pseudocode?
Integer mask = 0, i
Integer s[5] = {3, 1, 4, 1, 5}
for (each i from 0 to 4)
mask = mask | (1 << s[i])
end for
Integer c = 0
while (mask > 0)
c = c + (mask & 1)
mask = mask >> 1
end while
Print c
- A.
3
- B.
4
- C.
Sign up free to see the answer and a step-by-step explanation.