Bitwise complement basics — 1's complement Find the 1's complement (bit inversion) of the 8-bit binary value 10011101.

Difficulty: Easy

Correct Answer: 01100010

Explanation:


Introduction / Context:
The 1's complement of a binary number is obtained by flipping every bit: 0 becomes 1 and 1 becomes 0. This operation is used in certain checksum schemes, legacy signed representations, and bitwise logic. Here, we invert all bits of an 8-bit pattern exactly as written, preserving width with leading zeros if needed.


Given Data / Assumptions:

  • Original binary: 10011101 (8 bits).
  • We must output an 8-bit result.
  • No arithmetic addition or two’s complement steps are involved—only bitwise inversion.


Concept / Approach:

1's complement is computed bit by bit: each 1 → 0 and each 0 → 1. The length (8 bits) should remain unchanged, so we keep leading zeros that appear in the result.


Step-by-Step Solution:

Write the original: 1 0 0 1 1 1 0 1.Invert each bit: 0 1 1 0 0 0 1 0.Group into a string: 01100010.Confirm width: still 8 bits.


Verification / Alternative check:

Check pairwise: first bit 1 → 0, next two zeros → ones, three ones → zeros, zero → one, final one → zero. The count of ones and zeros swaps as expected.


Why Other Options Are Wrong:

10011110 differs only at the last bit and is not a full inversion of all positions.

01100001 and 01100011 each flip an incorrect end bit; only 01100010 inverts all bits correctly.


Common Pitfalls:

Mixing up 1's complement with 2's complement (which adds 1 after inversion), dropping leading zeros in the final string, or inverting only part of the pattern. Always preserve width when dealing with fixed-size registers.


Final Answer:

01100010

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion