Medium ●●

🔢 Number Systems & Binary Arithmetic

Why it matters: Quick marks: range of an n-bit representation, 2's complement conversion, and spotting overflow. Almost never anything harder than that.

Subtopics

Each subtopic has its own page: idea, why, how, example, play, check. Mark each one understood when it clicks. 0 of 4 done.

Formulas

Value in base r
N = Σ dᵢ · rⁱ (i negative for fraction digits)
Range of n bits (unsigned)
0 … 2ⁿ − 1
Range of n bits (2's complement)
−2ⁿ⁻¹ … +2ⁿ⁻¹ − 1
Range (sign-magnitude, 1's complement)
−(2ⁿ⁻¹ − 1) … +(2ⁿ⁻¹ − 1), two zeros
Negation in 2's complement
−x = (bitwise NOT x) + 1
Signed overflow
V = C_in(MSB) ⊕ C_out(MSB)
Gray code
g = b ⊕ (b >> 1); b = g ⊕ (g >> 1) ⊕ (g >> 2) ⊕ …
Bits for N values
⌈log₂ N⌉

What GATE asks from this

Question types seen repeatedly in past papers. More stars means more frequent.

★★★
Range or count of values in an n-bit representation
Which representation has two zeros, what is the most negative value, how many distinct values.
★★★
Add or subtract in 2's complement and detect overflow
Do the addition on bit patterns, then compare the carries into and out of the MSB.
★★★
Base conversion and unknown-base equations
Convert between bases or solve for the base r in an arithmetic identity.
★★★
Representation conversions (sign-extension, comparison of patterns)
Interpret a given bit pattern under a chosen representation and compare.

Ratings are approximate, based on recurring patterns in past GATE CSE papers.

Previous year questions

5 real questions from the official GATE CSE papers (2014 to 2017), newest first, each with the official answer key and a worked solution. Questions are the property of the GATE organising institutes; this copy is for your personal study.

5 questions · 0 correct of 0 attempted · marks 0 / 5

Year:
GATE 2017 Set 2 · Q1MCQ1 mark
The representation of the value of a 16-bit unsigned integer X in hexadecimal number system is BCA9. The representation of the value of X in octal number system is
GATE 2017 Set 2 · Q24NAT1 mark
Consider a quadratic equation x² − 13x + 36 = 0 with coefficients in a base b. The solutions of this equation in the same base b are x = 5 and x = 6. Then b = ______.
GATE 2016 Set 2 · Q9NAT1 mark
Let X be the number of distinct 16-bit integers in 2′s complement representation. Let Y be the number of distinct 16-bit integers in sign magnitude representation. Then X − Y is ______.
GATE 2014 Set 1 · Q8NAT1 mark
The base (or radix) of the number system such that the following equation holds is ______. 312 / 20 = 13.1
GATE 2014 Set 2 · Q8NAT1 mark
Consider the equation (123)₅ = (x8)ᵧ with x and y as unknown. The number of possible solutions is ______.

Common traps

In 2's complement the most negative number has no positive twin: negating −2ⁿ⁻¹ gives itself (and overflows).
Carry out of the MSB is not the signed overflow flag; the flag compares the last two carries.
Sign-extend with the sign bit, not with zeros, when widening a negative number.
1's complement and sign-magnitude both have +0 and −0, so they hold 2ⁿ − 1 distinct values, not 2ⁿ.