2's Complement Interview Questions and Answers: Binary Maths, Range and Overflow
Know the invert-and-add-one rule but struggle to explain it? Work through fixed-width examples, separate carry from overflow, and practise clear interview answers.
KnowledgeGate Team
Exam prep & CS education

Explaining why subtraction works, or why two positive numbers can produce a negative stored result, requires more than reciting "invert and add one". Fix the bit width first, then separate encoding, arithmetic and signed interpretation. Fixed-width binary arithmetic determines the stored result; a programming language's overflow behaviour does not change the representation.
1. What does two's complement actually represent?
Question: What is the signed value of 11101011?
Start by confirming the width and representation. In eight-bit two's complement, its unsigned value is 235, so its signed value is 235 - 256 = -21. Read as unsigned binary, the identical bits mean 235.
The most significant bit has a negative weight. For this pattern, the weighted sum is:
-128 + 64 + 32 + 8 + 2 + 1 = -21.
For an n-bit two's complement number, the range is -2^(n-1) through 2^(n-1) - 1. Eight bits therefore represent -128 through +127. There is one zero, 00000000; the negative end has one extra value.
State the width before applying any rule; two's complement interpretation depends on it.
2. How do you encode -13, and why does invert-plus-one work?
Question: Represent -13 in eight bits and justify the method.
Keep all eight positions throughout:
Step | Eight-bit pattern | Unsigned value |
|---|---|---|
Write +13 |
| 13 |
Invert every bit |
| 242 |
Add |
| 243 |
Decoding the answer gives 243 - 256 = -13.
Inversion subtracts the original value from the all-ones pattern: (2^8 - 1) - 13 = 255 - 13 = 242. Adding one gives 243 = 256 - 13. Adding that encoding to +13 gives 256, whose low eight bits are all zero.

The general operation finds the additive inverse modulo 2^n. This also handles zero: inverting 00000000 gives 11111111; adding one and retaining eight bits gives 00000000 again.
For the full concept-first derivation, read Two's Complement Arithmetic Explained: Signed Ranges, Subtraction, Overflow and Worked Examples; that post owns the 23 - 41 = -18 walkthrough, while these questions focus on concise interview explanations and edge-case reasoning.
3. How does subtraction become addition?
Question: Compute 13 - 21 using eight-bit arithmetic.
Encode +13 as
00001101and +21 as00010101.Invert +21 to get
11101010.Add one to obtain
11101011, the encoding of -21.Add:
00001101 + 11101011 = 11111000.Decode:
248 - 256 = -8.
The mathematical result -8 fits the signed range, so there is no signed overflow. Subtraction works because adding the modular inverse performs the same operation on the retained bits.
Now reverse the operands. For 21 - 13, add 00010101 + 11110011 = 1 00001000. The full unsigned sum is 21 + 243 = 264. Discard the ninth carry-out bit and retain 00001000, which is +8.
That carry-out does not imply signed overflow: +8 is representable. A complete spoken answer follows this sequence: choose the width, encode the operands, add, retain n bits, interpret the result, then check the signed range. “Discard carry” describes storage at a fixed width; you must still check overflow separately.
4. Is carry-out the same as signed overflow?
No. Carry-out and signed overflow answer different questions.
Consider 01000000 + 01000000 = 10000000. The operands are +64 and +64. Their true sum is +128, outside the eight-bit signed range, but the stored pattern represents -128. Signed overflow occurs even though carry-out is zero.
Now add 11110110 + 00001010 = 1 00000000. With signed operands, this is -10 + 10. The stored result is zero, which is correct. Carry-out is one, but signed overflow is absent.

For signed addition, equal-sign operands producing an opposite-sign result indicate overflow. Opposite-sign operands cannot overflow in addition. Apply this sign test to the stored result, while remembering that carry-out concerns the unsigned sum exceeding the available bits.
5. Which edge cases expose a memorised answer?
Negating the minimum value. In five bits, 10000 represents -16. Invert it to 01111, then add one: the result is 10000 again. This operation overflows because +16 cannot be represented in the five-bit signed range of -16 through +15.
Widen before negating. Eight-bit -9 is 11110111. Sign-extend it to 1111111111110111 before inversion; invert-plus-one gives 0000000000001001, which represents +9 in 16 bits.
Extending the wrong bit. Widening 11110111 (-9) to 16 bits requires sign extension: 1111111111110111. Zero extension instead produces 0000000011110111, or +247, changing the value.
Forgetting the width. Four-bit +3 is 0011; inversion gives 1100, and adding one gives 1101, representing -3. Eight-bit +3 is 00000011; inversion gives 11111100, and adding one gives 11111101, also representing -3.
The broader Number Representation Mistakes: Fix Signed Values, Complements and Overflow guide owns cross-representation diagnostics and the 5 - 3 carry-rule comparison; this post keeps the lens on spoken two's-complement answers.
The decimal value is unchanged, but the bit pattern depends on width. State that width before inverting, extending or interpreting any number.
6. How can an interview or assessment test the reasoning?
Try these prompts before reading their answers.
Minimum signed width for +128? Nine bits. Eight bits stop at +127; nine bits cover -256 through +255.
Minimum signed width for -128? Eight bits, whose range is -128 through +127. Seven bits only cover -64 through +63.
Does eight-bit -70 + -70 overflow? Yes. The encoding of -70 is
256 - 70 = 186, or10111010. Adding the patterns gives1 01110100. Retaining eight bits gives01110100, or +116, while the true sum is -140, below -128. Two negative operands have produced a positive stored result.
Narrate representation, operation and interpretation separately. This is useful rehearsal for service-company and product-company technical preparation.
Continue with 2's Complement MCQs: 12 Solved Questions with Explanations. Connect this revision to broader subject preparation through CS Fundamentals for Exams & Placements.
7. The short answer to remember, and the next step
Fix n first and state the signed range. Use invert-plus-one within those n bits to form the additive inverse, retain n result bits after arithmetic, and check signed overflow separately from carry-out. When widening a signed value, copy its sign bit.
Now redo 13 - 21 and 64 + 64 unaided. Explain why -8 is a valid signed result, while the stored -128 in the second calculation signals overflow. For an optional structured study route, explore the Digital Electronics course. Practise until you can justify each step, including the final interpretation.
Keep learning
Two's Complement Arithmetic Explained: Signed Ranges, Subtraction, Overflow and Worked Examples
Build a reliable 8-bit method for encoding signed values, subtracting with complements, detecting overflow, extending signs and checking every result.
2's Complement MCQs: 12 Solved Questions with Explanations
Solve 12 GATE 2's complement MCQs step by step, from negative encoding and sign extension to multiplication, hexadecimal scaling and fixed-width overflow.
1's Complement Interview Questions and Answers: Binary Basics, Range and Addition
Remembering 'flip every bit' is only the start. Rehearse short interview answers on fixed widths, signed encodings and overflow, then trace both directions of a subtraction.
1's Complement Explained: Binary Conversion, Addition and Worked Examples
Learn how fixed-width 1's complement numbers represent negatives, why zero has two encodings, and how end-around carry works through exact examples.





