Data Structures & AlgorithmsHardTCS NQT · Accenture

How many 1 bits does the binary representation of 45 contain?

  1. A. 5
  2. B. 6
  3. C. 8
  4. D. 4

Correct answer: D. 4

45 = 32 + 8 + 4 + 1 = 101101 in binary, which has four 1 bits.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic