Data Structures & AlgorithmsModerateTCS NQT Digital · Accenture
Problem: Reverse the 8-bit binary representation of 13 (00001101) and report the resulting unsigned value in decimal.
- A. 176
- B. 11
- C. 242
- 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
- Problem: What is the smallest positive integer x such that 1 + 2 + … + x is at least 100?
- Problem: How many composite numbers lie in the range 2 to 50 (inclusive)?
- Problem: How many integers x with 0 ≤ x ≤ 99 satisfy x³ ≡ x (mod 7)?
- Problem: Daily temperatures are [73, 74, 75, 71, 69, 72, 76, 73]. For each day, the wait is the number of days until a strictly warmer day…
- Problem: In the binary array [1, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1] at most 2 zeros may be flipped to 1. What is the length of the longest run…
- Problem: Starting from the empty set, a process inserts the numbers 5, 3, 8, 1, 4, 7 into a binary search tree, and then deletes nothing…