Question PSC-BIT-0079
HardWhat will be printed by the following pseudocode?
Integer s = 0, mask
for (each mask from 0 to 15)
Integer bits = 0, t = mask
while (t > 0)
bits = bits + (t & 1)
t = t >> 1
end while
if (bits == 2)
s = s + 1
end if
end for
Print s
- A.
4
- B.
16
- C.
Sign up free to see the answer and a step-by-step explanation.