Question PSC-BIT-0062
HardWhat does the following pseudocode print?
Integer x = 0b10110100
Integer c = 0
while (x != 0)
x = x & (x - 1)
c = c + 1
end while
Print c
- A.
3
- B.
4
- C.
Sign up free to see the answer and a step-by-step explanation.
Popular companies
Prepare company by company
Hiring pattern, syllabus, past questions and mocks for each company.
All companiesPractice by subject
Bitwise Operators question
What does the following pseudocode print?
Integer x = 0b10110100
Integer c = 0
while (x != 0)
x = x & (x - 1)
c = c + 1
end while
Print c
3
4
Sign up free to see the answer and a step-by-step explanation.
8
5