Number Systems and Codes: GATE ECE practice questions with solutions
This topic covers base conversions, two's complement and other signed forms, BCD, excess-3, Gray and Hamming codes, and IEEE 754 floats. The 15 original questions follow the GATE EC format: 9 MCQ, 2 MSQ and 4 NAT, from 5 easy, 7 medium and 3 hard.
Three ideas to know:
- Bits after the binary point carry weights 2⁻¹, 2⁻², 2⁻³ and so on.
- Each excess-3 digit is the digit's BCD value plus 3, so decoding subtracts 3 per digit.
- Value = (−1)ˢ × 1.f × 2^(e − 127) for normal numbers.
It helps GATE EC and ECE students revising Digital Circuits for the exam or a semester test. Helpful background: BCD and two's complement. Start with the 5 easy questions, then work up to the 3 hard ones.
Related
Q.1
EasyMCQ1 mark
The unsigned binary number (10110.101)₂ is equal to which decimal value?
Show answer and solutionHide answer and solution
Answer: (B)
Key idea: Bits after the binary point carry weights 2⁻¹, 2⁻², 2⁻³ and so on.
1. Integer part: 10110₂ = 16 + 4 + 2 = 22.
2. Fraction part: 0.101₂ = 1/2 + 0/4 + 1/8 = 0.625.
3. Total = 22.625.
Common mistake: Reading the fraction 101 as the integer 5 and writing 22.5, or weighting the third fraction bit as 1/6.
You need: Positional notation
Q.2
EasyMCQ1 mark
The hexadecimal number (3AF)₁₆ written in octal is
Show answer and solutionHide answer and solution
Answer: (C)
Key idea: Hex and octal both convert through binary: 4 bits per hex digit, 3 bits per octal digit.
1. Expand each hex digit to 4 bits: 3 = 0011, A = 1010, F = 1111, giving 0011 1010 1111.
2. Regroup from the right in 3s: 001 110 101 111.
3. Read each group: 1, 6, 5, 7, so (1657)₈.
4. Check: 1×512 + 6×64 + 5×8 + 7 = 943, and 3×256 + 10×16 + 15 = 943.
Common mistake: Dropping the leading zeros and grouping the bits 1110101111 in 3s from the left (111 010 111 1) instead of from the right, which gives the wrong digits.
You need: Binary, octal and hexadecimal digits
Q.3
EasyNAT1 mark
The 8-bit pattern 10101100 holds a signed integer in two's complement form. Its decimal value is ______.
Numerical answer: type a number.
Show answer and solutionHide answer and solution
Answer: −84
Key idea: For an n-bit two's complement word with MSB set, value = unsigned value − 2ⁿ.
1. The leading bit is 1, so the number is negative.
2. Read it as unsigned: 128 + 32 + 8 + 4 = 172.
3. Subtract 2⁸: 172 − 256 = −84.
Common mistake: Inverting the bits without adding 1, giving 01010011 = 83 and an answer of −83.
You need: Two's complement representation
Q.4
EasyMCQ1 mark
The 4-bit binary number 1011 converted to Gray code is
Show answer and solutionHide answer and solution
Answer: (A)
Key idea: Each Gray bit is the XOR of the binary bit in that position and the binary bit to its left.
1. The Gray MSB equals the binary MSB: g₃ = 1. 2. g₂ = b₃ ⊕ b₂ = 1 ⊕ 0 = 1. 3. g₁ = b₂ ⊕ b₁ = 0 ⊕ 1 = 1. 4. g₀ = b₁ ⊕ b₀ = 1 ⊕ 1 = 0.
5. Gray code = 1110.
Common mistake: Using the Gray-to-binary rule (XOR with the previous output bit), which turns 1011 into 1101.
You need: XOR operation
Q.5
EasyMCQ1 mark
The decimal number 59 in 8421 BCD is
Show answer and solutionHide answer and solution
Answer: (D)
Key idea: BCD encodes digits, not the whole number's binary value.
1. BCD codes each decimal digit separately in 4 bits. 2. 5 = 0101 and 9 = 1001.
3. So 59 = 0101 1001.
Common mistake: Converting 59 to straight binary (0011 1011), or writing its excess-3 code (1000 1100).
You need: Binary codes for 0 to 9
Q.6
MediumNAT2 marks
A display controller receives a three-digit decimal number in excess-3 code as the 12-bit word 1001 0100 0110 (most significant digit first). The decimal number is ______.
Numerical answer: type a number.
Show answer and solutionHide answer and solution
Answer: 613
Key idea: Each excess-3 digit is the digit's BCD value plus 3, so decoding subtracts 3 per digit.
1. Split into digits: 1001, 0100, 0110.
2. Read each group as binary: 9, 4, 6.
3. Subtract 3 from each: 6, 1, 3.
4. The number is 613.
Common mistake: Reading the groups as BCD and answering 946, or subtracting 3 from the whole 12-bit value.
You need: BCD, excess-3 code
Q.7
MediumMCQ2 marks
An 8-bit adder treats its inputs as two's complement numbers. It adds X = 01101100 and Y = 01010010 and keeps only 8 bits of the result. Which statement is correct?
Show answer and solutionHide answer and solution
Answer: (B)
Key idea: Signed overflow happens when two operands of the same sign give a result of the opposite sign. Carry out alone does not show it.
1. X = 108 and Y = 82, both positive.
2. The true sum is 190, beyond the 8-bit maximum of +127.
3. Binary sum: 01101100 + 01010010 = 10111110, with no carry out of bit 7.
4. Two positive inputs gave a result with MSB 1 (read as −66), so overflow has occurred.
Common mistake: Deciding "no overflow" because there is no carry out of the MSB, which is the unsigned rule.
You need: Two's complement addition
Q.8
MediumMSQ2 marks
The decimal value −19 is stored in an 8-bit register. Which of the following are correct 8-bit representations of −19 in the system named?
One or more options are correct.
Show answer and solutionHide answer and solution
Answer: (A), (B) and (D)
Key idea: The three signed formats agree for positive numbers and differ only for negatives.
1. +19 = 00010011.
2. Sign-magnitude sets the MSB: 10010011, so (A) is correct.
3. One's complement inverts every bit: 11101100, so (B) is correct.
4. Two's complement adds 1 to the one's complement: 11101101, so (D) is correct and (C) is the one's complement pattern mislabeled.
Common mistake: Forgetting the final +1 for two's complement and choosing (C).
You need: Sign-magnitude, one's and two's complement
Q.9
MediumNAT1 mark
In an unknown base b, the number (231)_b equals 91 in decimal. The base b is ______.
Numerical answer: type a number.
Show answer and solutionHide answer and solution
Answer: 6
Key idea: A number's digits fix a polynomial in the base, so an equation in b gives the base.
1. Expand: 2b² + 3b + 1 = 91.
2. Rearrange: 2b² + 3b − 90 = 0.
3. Quadratic formula: b = (−3 + √(9 + 720)) ÷ 4 = (−3 + 27) ÷ 4 = 6.
4. Every digit (2, 3, 1) is less than 6, so base 6 is valid. Check: 2×36 + 3×6 + 1 = 91.
Common mistake: Taking the negative root, or not checking that every digit is smaller than the base.
You need: Positional notation in any base
Q.10
MediumMCQ1 mark
A sensor reports integer temperatures from −300 to +300. What is the minimum number of bits needed to store every value in two's complement form?
Show answer and solutionHide answer and solution
Answer: (C)
Key idea: The positive limit, 2ⁿ⁻¹ − 1, is usually the one that sets n.
1. An n-bit two's complement word holds −2ⁿ⁻¹ to 2ⁿ⁻¹ − 1. 2. 9 bits: −256 to +255, too small for ±300. 3. 10 bits: −512 to +511, which covers −300 to +300.
4. So 10 bits.
Common mistake: Counting the 9 bits that 300 needs as an unsigned number and forgetting the sign bit.
You need: Two's complement range
Q.11
MediumMCQ2 marks
A link uses a Hamming (7,4) code with even parity. Bit positions 1 to 7 hold p1, p2, d1, p4, d2, d3, d4. Parity p1 covers positions 1, 3, 5, 7; p2 covers 2, 3, 6, 7; p4 covers 4, 5, 6, 7. The receiver gets 1110110 (position 1 first). Assuming at most one bit is in error, the corrected data bits d1 d2 d3 d4 are
Show answer and solutionHide answer and solution
Answer: (D)
Key idea: The syndrome read as a binary number is the position of the flipped bit.
1. Received: r1 = 1, r2 = 1, r3 = 1, r4 = 0, r5 = 1, r6 = 1, r7 = 0. 2. c1 = r1 ⊕ r3 ⊕ r5 ⊕ r7 = 1 ⊕ 1 ⊕ 1 ⊕ 0 = 1. 3. c2 = r2 ⊕ r3 ⊕ r6 ⊕ r7 = 1 ⊕ 1 ⊕ 1 ⊕ 0 = 1. 4. c4 = r4 ⊕ r5 ⊕ r6 ⊕ r7 = 0 ⊕ 1 ⊕ 1 ⊕ 0 = 0.
5. Syndrome c4 c2 c1 = 011 = 3, so position 3 is wrong.
6. The corrected word is 1100110, and the data at positions 3, 5, 6, 7 are 0, 1, 1, 0.
Common mistake: Reading the data straight from the received word (1110) without correcting it, or reading the syndrome in the order c1 c2 c4, which gives 6.
You need: Parity, Hamming code construction
Q.12
MediumMCQ2 marks
A 16-bit register in a microcontroller holds 0xFF9C. Read as a two's complement signed integer, its value is
Show answer and solutionHide answer and solution
Answer: (A)
Key idea: For a 16-bit word, signed value = unsigned value − 65536 when bit 15 is set.
1. The MSB of 0xF... is 1, so the value is negative.
2. Unsigned value: 0xFF9C = 65436.
3. Subtract 2¹⁶ = 65536: 65436 − 65536 = −100.
4. Check: −100 = −0x0064, and 0x10000 − 0x0064 = 0xFF9C.
Common mistake: Reporting the unsigned value 65436, or reading only the low byte 0x9C as a signed 8-bit value and getting −100 for the wrong reason.
You need: Hexadecimal, two's complement
Q.13
HardMCQ2 marks
A 32-bit word 0xC1480000 holds an IEEE 754 single-precision floating-point number (1 sign bit, 8-bit exponent with bias 127, 23-bit fraction with a hidden leading 1). Its decimal value is
Show answer and solutionHide answer and solution
Answer: (C)
Key idea: Value = (−1)ˢ × 1.f × 2^(e − 127) for normal numbers.
1. Binary: 1100 0001 0100 1000 0000 0000 0000 0000.
2. Sign = 1, so the number is negative.
3. Exponent field = 1000 0010 = 130, so the true exponent is 130 − 127 = 3.
4. Fraction = 1001 0000…, so the significand is 1.1001₂ = 1 + 0.5 + 0.0625 = 1.5625.
5. Value = −1.5625 × 2³ = −12.5.
Common mistake: Dropping the hidden 1 (giving −0.5625 × 8 = −4.5), or misreading the exponent field as 131 instead of 130, which gives a true exponent of 4 and −1.5625 × 16 = −25.0.
You need: Floating-point format, binary fractions
Q.14
HardMSQ2 marks
An 8-bit pattern P = 11010110 is read in different ways. Which of the following statements are true?
One or more options are correct.
Show answer and solutionHide answer and solution
Answer: (A) and (C)
Key idea: The same bits mean different numbers under different codes. The code decides the value.
1. Unsigned: 128 + 64 + 16 + 4 + 2 = 214, so (A) is true.
2. The upper nibble 1101 = 13 is not a decimal digit, so P is not valid BCD and (B) is false.
3. Gray to binary: b₇ = 1; then each bit is the previous binary bit XOR the next Gray bit: 1, 0, 0, 1, 1, 0, 1,
1. So the binary is 10011011 (155) and (C) is true.
4. Two's complement: 214 − 256 = −42, not −41, so (D) is false.
Common mistake: In Gray to binary, XORing adjacent Gray bits instead of the previous binary output bit; or getting −41 by inverting without adding 1.
You need: BCD, Gray code, two's complement
Q.15
HardNAT2 marks
Two octal numbers are multiplied: (54)₈ × (23)₈. The product, written in octal, is ______. (Enter the octal digits as a number.)
Numerical answer: type a number.
Show answer and solutionHide answer and solution
Answer: 1504
Key idea: Convert to decimal, do the arithmetic, then convert back; or multiply directly in base 8 with carries of 8.
1. Convert to decimal: (54)₈ = 5×8 + 4 = 44 and (23)₈ = 2×8 + 3 = 19.
2. Multiply: 44 × 19 = 836.
3. Convert back by repeated division by 8: 836 ÷ 8 = 104 r 4; 104 ÷ 8 = 13 r 0; 13 ÷ 8 = 1 r 5; 1 ÷ 8 = 0 r 1.
4. Read the remainders upward: (1504)₈. Check: 512 + 5×64 + 0 + 4 = 836.
Common mistake: Multiplying the digits as if they were decimal (54 × 23 = 1242), or carrying in tens during direct octal multiplication.
You need: Base conversion, repeated division