GATE GUIDE

Number Representation Questions in GATE CSE Digital Logic

By MD ANISH AHAMADUpdated 29 Oct 202611 min read
Number Representation Questions in GATE CSE Digital Logic

Number representation is the part of Digital Logic that almost never changes shape. The question is either a bit pattern you must turn into a decimal value, a decimal value you must turn into a bit pattern, or a statement about ranges, overflow and precision that you must mark true or false. The computation is short. The marks are lost on details: which direction the bias goes, whether a carry out means overflow, how many fraction bits are actually stored.

In this guide
  1. Key takeaways
  2. What the 2027 syllabus puts in scope
  3. How much this is worth
  4. Two's complement: the asymmetry is the exam
  5. Overflow, and why a carry out is not overflow
  6. Sign extension, zero extension and comparison
  7. IEEE 754: fields, bias and the implicit one
  8. One conversion, worked end to end
  9. Spacing, and why a small addend disappears
  10. The traps, in one list
  11. How to practise

Key takeaways

What the 2027 syllabus puts in scope

The official GATE 2027 CS syllabus gives Digital Logic as Boolean algebra and minimization with algebraic, Karnaugh map and tabular techniques, design of combinational and sequential circuits, and number representation and arithmetic in fixed and floating point. The 2026 wording said number representations and computer arithmetic. Nothing was added or removed from this clause for 2027; the rewriting touched the minimization and circuit-design clauses. Check the current notification before planning around it.

That one clause covers base conversion, unsigned and signed formats, fixed-point resolution, two's complement arithmetic with overflow, and the whole of IEEE 754 including special values, precision and rounding. The same material reappears inside Computer Organization when ALU and floating-point units are tested, which is why an afternoon spent here pays twice. The wider subject map is in the Digital Logic important topics guide.

How much this is worth

Analyst compilations, unofficial and disagreeing with each other by two or three marks because borderline questions get filed under Computer Organization, put Digital Logic at 5, 7, 8, 3, 3, 2.3, 5.7, 3, 3, 4, 9, 4, 4, 3, 6, 5, 6 and 5 marks per paper from 2009 to 2026. That averages about 4.8, low 2.3, high 9. By era, 2009 to 2017 averages 4.4 and 2018 to 2026 averages 5.1, so the direction is stable with spikes in 2011 and 2019. One analyst counted four Digital Logic questions in 2026 shift 2.

The book treats Digital Logic as a low-weight subject at an expected 4 to 7 marks for 2027, while noting that it is one of the two most formula-stable subjects and returns the best marks per hour of preparation. Analysts rate General Aptitude and Digital Logic the easiest parts of the paper, and within this subject K-maps, counters and flip-flops, and number representation are the recurring items.

Two's complement: the asymmetry is the exam

In nn bits, the sign bit carries weight −2n−1-2^{n-1} while the remaining bits carry their ordinary positive weights. The value of a pattern is therefore the sign term plus the unsigned value of the low n−1n-1 bits:

value=−bn−1×2n−1+∑i=0n−2bi 2i\text{value} = -b_{n-1} \times 2^{n-1} + \sum_{i=0}^{n-2} b_i \, 2^i

That single formula explains the range. The smallest value is 1000...0, equal to −2n−1-2^{n-1}. The largest is 0111...1, equal to 2n−1−12^{n-1} - 1. There are 2n2^n codes, one is zero, and the rest split 2n−12^{n-1} negatives against 2n−1−12^{n-1} - 1 positives.

To negate, invert every bit and add one. Try it on 8-bit 10000000, which is -128: inverting gives 01111111 and adding one returns 10000000. The most negative number is its own negation, because +128 does not exist in 8 bits. That is the source of the classic statement-marking question.

Format nn-bit range Codes for zero Negation rule
Unsigned 00 to 2n−12^n - 1 one not representable
Sign-magnitude −(2n−1−1)-(2^{n-1} - 1) to 2n−1−12^{n-1} - 1 two (+0+0 and −0-0) flip the sign bit
One's complement −(2n−1−1)-(2^{n-1} - 1) to 2n−1−12^{n-1} - 1 two (+0+0 and −0-0) invert all bits
Two's complement −2n−1-2^{n-1} to 2n−1−12^{n-1} - 1 one invert all bits, add one

Sign-magnitude and one's complement both waste a code on negative zero, which is why each represents one fewer distinct value than two's complement at the same width. A question phrased as the difference between the counts of representable values in two systems is asking exactly this, and the answer is one.

Two's complement also removes the need for a subtractor. A−BA - B is A+B‾+1A + \overline{B} + 1, that is, AA plus the complement of BB plus one, which is why one adder with a row of inverters and a carry-in of one does both operations.

Overflow, and why a carry out is not overflow

Overflow in signed addition means the true mathematical sum falls outside the representable range. Two equivalent tests:

Both say the same thing, and both say that adding numbers of opposite signs can never overflow, since such a sum is bounded by the larger operand's magnitude, which already fits.

The carry out of the most significant bit is the unsigned overflow flag, and in signed arithmetic it means nothing on its own. Add 8-bit 11111111 and 00000001: the carry out is 1, but the operands are -1 and +1, the result is 00000000, and that is correct. Now add 01000000 and 01000000: no carry out at all, but both operands are +64, the result 10000000 reads as -128, and that is overflow. Hardware keeps two separate flags, and a question mentioning only one of them is usually testing whether you know which.

Sign extension, zero extension and comparison

Widening a value from n bits to m bits is not one operation. If the value is signed, copy the sign bit into every new high-order position. If it is unsigned, fill with zeros. The 8-bit pattern 11111100 becomes 1111111111111100 in 16 bits when sign-extended, which is still -4, but 0000000011111100 when zero-extended, which is 252.

The same fork appears in comparison. The patterns 11111111 and 00000001 compare as 255 greater than 1 under unsigned rules and as -1 less than 1 under signed rules. Nothing in the bits tells you which rule applies; only the declared type does. That is the bridge to C output questions and to the ALU flag questions in Computer Organization.

Multiplying by 2k2^k is a left shift in both systems. Dividing by 2k2^k is a logical right shift when unsigned and an arithmetic right shift, replicating the sign bit, when signed. Arithmetic right shift rounds towards negative infinity, so -7 shifted right by one gives -4, not -3.

IEEE 754: fields, bias and the implicit one

A normalised value is

(−1)S×1.F×2E−bias(-1)^S \times 1.F \times 2^{E - \text{bias}}

where EE is the unsigned exponent field, FF is the stored fraction, and the leading one before the point is implicit and not stored.

Field Single (32-bit) Double (64-bit)
Sign 1 bit 1 bit
Exponent 8 bits, bias 127 11 bits, bias 1023
Stored fraction 23 bits 52 bits
Significand precision 24 bits including the implicit one 53 bits including the implicit one
True exponent range (normalised) -126 to +127 -1022 to +1023
Smallest normalised magnitude 2−126≈1.18×10−382^{-126} \approx 1.18 \times 10^{-38} 2−1022≈2.2×10−3082^{-1022} \approx 2.2 \times 10^{-308}
Largest finite magnitude (2−2−23)×2127≈3.4×1038(2 - 2^{-23}) \times 2^{127} \approx 3.4 \times 10^{38} (2−2−52)×21023≈1.8×10308(2 - 2^{-52}) \times 2^{1023} \approx 1.8 \times 10^{308}

The exponent field is biased rather than signed so that positive floats sort in the same order as the integers formed from their bits. Stored field equals true exponent plus bias: encoding adds, decoding subtracts. Reversing that is the commonest single error in this topic.

Two exponent fields are reserved:

So the usable normalised exponent fields run from 1 to 254 in single precision, giving true exponents -126 to +127. Not 0 to 255, and not -127 to +128.

One conversion, worked end to end

Encode -6.25 in single precision.

  1. Magnitude in binary: 6 is 110 and 0.25 is 0.01, so 6.25 is 110.01.
  2. Normalise: 110.012=1.10012×22110.01_2 = 1.1001_2 \times 2^2. The true exponent is 2.
  3. Exponent field: 2+127=1292 + 127 = 129, which is 10000001.
  4. Stored fraction: drop the leading 1, keep 1001, pad to 23 bits.
  5. Sign bit: 1, since the number is negative.

The 32 bits are 1 10000001 10010000000000000000000. Grouped into nibbles from the left, that is C0C80000 in hexadecimal. Decoding it back is the same steps in reverse, with the sign bit set:

True exponent=100000012−127=129−127=2Significand=1.10012=1.5625Value=−(1.5625×22)=−(1.5625×4)=−6.25\begin{aligned} \text{True exponent} &= 10000001_2 - 127 = 129 - 127 = 2 \\ \text{Significand} &= 1.1001_2 = 1.5625 \\ \text{Value} &= -(1.5625 \times 2^2) = -(1.5625 \times 4) = -6.25 \end{aligned}

Spacing, and why a small addend disappears

Within one binade, single-precision numbers are spaced 2E−bias×2−232^{E - \text{bias}} \times 2^{-23} apart, and that spacing doubles each time the exponent increases by one. Near 1.0 the gap is about 1.19×10−71.19 \times 10^{-7}; near 2232^{23} the gap is exactly 1.

The consequence is a favourite statement question. The spacing at 2242^{24} is 2, so 224+12^{24} + 1 is not representable and rounds back to 2242^{24}. The largest integer single precision holds exactly is therefore 224=167772162^{24} = 16777216. Add 1 to it repeatedly and the value never moves.

The same effect breaks associativity. With a limited significand, (a+b)+c(a + b) + c and a+(b+c)a + (b + c) can differ when aa is large and bb and cc are small, because the small values are annihilated one at a time in one grouping and survive by combining in the other. Such questions are often set in three-significant-digit decimal rather than binary. These bounds and formulas are collected in the GATE CSE formula sheet.

The traps, in one list

A wider version of this list is in the guide to common mistakes that cost marks. The Digital Logic chapter of the GATE CSE 2027 book goes beyond this article by tabulating every number representation and floating point question form against the years it appeared, with full solutions and the prediction score behind each one.

How to practise

Fix one width and stay in it. Take 8 bits, write out -128, -1, 0, 1 and 127 as patterns, and reproduce them from memory until it is automatic. Then add pairs chosen to overflow and pairs chosen not to, marking both the carry flag and the overflow flag each time.

For floating point, build one small table: the hexadecimal encodings of 1.0, 0.5, -6.25, the smallest normalised value and positive infinity in single precision. Those five cover almost every decode question asked. Convert each in both directions on paper until the bias step needs no second thought. The virtual calculator does not help here; the task is bookkeeping, and bookkeeping is trained by repetition.

Frequently asked questions

What is the range of an n-bit two's complement number?

The range is −2n−1-2^{n-1} to 2n−1−12^{n-1} - 1. For 8 bits that is -128 to 127, and for 16 bits it is -32768 to 32767. The range is asymmetric because the all-zero pattern is used for zero, which leaves one more code on the negative side than on the positive side.

When does overflow occur in two's complement addition?

Overflow happens only when both operands have the same sign and the result carries the opposite sign. The equivalent hardware test is that the carry into the sign bit differs from the carry out of it. Adding two numbers of opposite signs can never overflow, and a carry out on its own is not overflow in signed arithmetic.

How do you convert a decimal number to IEEE 754 single precision?

Write the magnitude in binary, shift the point until one digit remains to its left, and note the shift as the exponent. Add 127 to that exponent to get the 8-bit exponent field. Drop the leading one and take the next 23 bits as the stored fraction. Set the sign bit last, then group all 32 bits into hexadecimal nibbles.

Why is the bias 127 in single precision and 1023 in double precision?

The exponent field is stored as an unsigned number so that floating point values can be compared almost like integers. The bias is 2k−1−12^{k-1} - 1 for a kk-bit field, which gives 127 for 8 bits and 1023 for 11 bits. The stored field is the true exponent plus the bias, so you subtract the bias when decoding and add it when encoding.

What are denormalised numbers in IEEE 754?

When the exponent field is all zeros, the implicit leading one is dropped and the value becomes 0.F×2−1260.F \times 2^{-126} in single precision. These denormals fill the gap between zero and the smallest normalised magnitude, at the cost of significant digits. The smallest positive single-precision denormal is 2−1492^{-149}, while the smallest normalised value is 2−1262^{-126}.

Are number representation questions asked every year in GATE CSE?

The book's PYQ reconstruction lists two's complement value, range and overflow among the most repeated Digital Logic items, alongside K-maps and counters, and it records IEEE 754 decoding appearing more often since 2021. That record makes the topic a high-priority one for 2027, but no topic is guaranteed to appear in any particular paper.

Sources

Dates, fees and the syllabus are set by the GATE 2027 organising institute and can change. Always confirm at gate2027.iitm.ac.in.

Keep reading

GATE CSE 2027 book1,020 pages · ₹250 ₹300
Buy now — ₹250