Data Structures & AlgorithmsModerateTCS NQT Digital · Accenture

Problem: Reverse the 8-bit binary representation of 13 (00001101) and report the resulting unsigned value in decimal.

  1. A. 176
  2. B. 11
  3. C. 242
  4. D. 208

Correct answer: A. 176

00001101 reversed is 10110000 = 128 + 32 + 16 = 176. Reversing only the 4 significant bits gives 1011 = 11, bitwise NOT gives 242, and swapping the nibbles gives 11010000 = 208.

More Coding Interview Problems questions

Exams that ask this topic