GATE / CS ARCHIVE

SUBJECT COLLECTION

Digital Logic · Binary Codes & Error Detection

7 questions, newest first

GATE CSE has asked 7 questions on Binary Codes & Error Detection (Digital Logic) from 1994 to 2021, in 6 of the 46 papers; the most recent is in GATE CSE 2021 Set 1. In the last five years it carried 0 marks per 100-mark paper on average, against 0.1 since 2003. Since 2014 the questions have been 1 MCQ. 2 groups of questions here are solved the same way; “One per method” keeps the newest of each.

Browse topics
2 marks · MCQ
Report issue

Binary Codes & Error Detection

Question 29, GATE 2021: A 12-bit Hamming codeword is d8 d7 d6 d5 c8 d4 d3 d2 c4 d1 c2 c1, listed from left to right. Data d8...d1 are 1,1,0,x,0,1,0,1; check bits c8,c4,c2,c1 are y,0,1,0. Find x,y. A 0,0; B 0,1; C 1,0; D 1,1.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Step through it (5 steps)

Number codeword positions from the right. The c2 parity group at positions 2, 3, 6, 7, 10, 11 already has four ones, establishing even parity. The c1 group at 1, 3, 5, 7, 9, 11 has 2+x ones, so x=0. The c8 group at 8, 9, 10, 11, 12 then has y+2 ones, so y=0. Thus A. This uses the parity convention inferred from the supplied known check group, not an unprovided arbitrary choice.

The positions from right to left are 1:c1=0,2:c2=1,3:d1=1,4:c4=0,5:d2=0,6:d3=1,7:d4=0,8:c8=y,9:d5=x,10:d6=0,11:d7=1,12:d8=1. Each parity check includes positions whose binary index has its corresponding bit set. After x=y=0, c4's group {4,5,6,7,12} also has two ones, verifying consistency with the parity convention inferred from c2.

Original paper, page 25 · Answer key

2 marks · MCQ
Report issue

Next value in reflected Gray code

Binary Codes & Error Detection

Question 40, GATE 2006: Let h₃h₂h₁h₀ be the four-bit reflected Gray code of n, and g₃g₂g₁g₀ the Gray code of (n+1) mod 16. Minterm indices refer to the current Gray word h. Which next-bit function is correct? GateForum A includes minterm 3; GFG appears to print 5 in that position.
Options:
(A) g₀=Σm(1,2,3,6,10,13,14,15) [GateForum; GFG: 1,2,5,6,10,13,14,15]
(B) g₁=Σm(4,9,10,11,12,13,14,15)
(C) g₂=Σm(2,4,5,6,7,12,13,15)
(D) g₃=Σm(0,1,6,7,10,11,12,13)
Question 40, GATE 2006: Let h₃h₂h₁h₀ be the four-bit reflected Gray code of n, and g₃g₂g₁g₀ the Gray code of (n+1) mod 16. Minterm indices refer to the current Gray word h. Which next-bit function is correct? GateForum A includes minterm 3; GFG appears to print 5 in that position.
Options:
(A) g₀=Σm(1,2,3,6,10,13,14,15) [GateForum; GFG: 1,2,5,6,10,13,14,15]
(B) g₁=Σm(4,9,10,11,12,13,14,15)
(C) g₂=Σm(2,4,5,6,7,12,13,15)
(D) g₃=Σm(0,1,6,7,10,11,12,13)
Tap to enlarge
Your answer
Answer & solution

Answer: C (no official key was published)

1. Use h(n)=n⊕(n>>1) and g=h((n+1) mod16). Enumerating n=0,...,15 gives the ON-set for g2, indexed by the present Gray word h, as{2,4,5,6,7,12,13,15}, exactly C.

2. As cross-checks, g0 has{0,1,6,7,10,11,12,13}, g1 has{1,2,3,6,10,13,14,15}, and g3 has{4,9,10,11,12,13,14,15}; the other options attach these sets to wrong output bits.

3. Teaching check: Gray-code minterm indices are the current Gray words, not the underlying binary n values. For example n=0 gives h=0000 and next g=0001, so the present-state index zero belongs to g₀’s ON set. This immediately distinguishes some mislabeled alternatives.

Original paper, page 5

2 marks · MCQ
Report issue

BCD threshold detector gate count

Binary Codes & Error Detection

Question 58, GATE 2004: A decimal digit is encoded in four-bit BCD: 0=0000,…,9=1001. A combinational circuit must output 1 iff the digit is at least 5. Using only AND,OR,NOT gates, what is the minimum number of gates?
Options:
(A) 2
(B) 3
(C) 4
(D) 5
Tap to enlarge
Your answer
Answer & solution

Answer: B (no official key was published)

1. Write the BCD inputs A,B,C,D with weights 8,4,2,1. For valid digits 0–9, the threshold predicate digit≥5 is A OR[B AND(C OR D)].

2. This uses three gates: one OR for C+D, one AND with B, and one OR with A. All four inputs are essential on valid BCD pairs (0/8,1/5,4/6,4/5 respectively), and a two-gate AND/OR/NOT network cannot express both the independent A case and the nested B∧(C∨D) case.

3. Invalid BCD encodings 10–15 are unspecified/don’t-care, as the source produces a digit.

4. Teaching check: Use digit weights 8,4,2,1. Digits 8 and 9 are detected by the 8-bit; digits 5,6,7 require the 4-bit and at least one low bit. Values 10–15 are not decimal digits supplied by this source, so they are don’t-care cases rather than additional truth-table requirements.

Original paper, page 8

Descriptive
Report issue

Minimal POS for excess-3 to BCD b₄

Binary Codes & Error Detection

Question 10(b), GATE 2001: Input bits e8,e4,e2,e1 encode decimal d as d+3 (valid codes 3…12); output b4 is the weight-4 BCD bit. Diagram has four excess-3 input lines and four BCD outputs b8,b4,b2,b1. GFG explicitly requests b4; GateForum omits the subscript in its prose.

Task: Give a minimal product-of-sums expression for b4.
Question 10(b), GATE 2001: Input bits e8,e4,e2,e1 encode decimal d as d+3 (valid codes 3…12); output b4 is the weight-4 BCD bit. Diagram has four excess-3 input lines and four BCD outputs b8,b4,b2,b1. GFG explicitly requests b4; GateForum omits the subscript in its prose.

Task: Give a minimal product-of-sums expression for b4.
Tap to enlarge
Shared context

Input bits e8,e4,e2,e1 encode decimal d as d+3 (valid codes 3…12); output b4 is the weight-4 BCD bit. Diagram has four excess-3 input lines and four BCD outputs b8,b4,b2,b1.

Answer & solution

Answer: b4=(¬e4+e1)(¬e4+e2)(e4+¬e2+¬e1). (no official key was published)

1. For decimal digits d=0…9, the weight-4 BCD bit is 1 exactly for d=4,5,6,7. Their excess-3 inputs are 7,8,9,10. Hence the on-set is {7,8,9,10}; the valid zero-set is {3,4,5,6,11,12}. Codes {0,1,2,13,14,15} are don’t-cares.

2. For a product-of-sums minimize groups of zeros, permitting invalid codes as don’t-cares. The group e4=1,e1=0 covers zero codes 4,6,12 and don’t-care 14, giving the clause ¬e4+e1.

3. The group e4=1,e2=0 covers 4,5,12 and don’t-care 13, giving ¬e4+e2. The pair 3,11 has e4=0,e2=1,e1=1 while e8 varies, giving e4+¬e2+¬e1.

4. Multiplying these clauses covers every required zero and no required one. The e8 input disappears because the chosen groups span both of its values.

5. To check minimality without claiming these groups are all essential, enumerate the maximal zero/don’t-care cubes (bit order e8,e4,e2,e1; dash means either value): -011, -1-0, -10-, 0--0, 0-0-, 00--, 1-11, 11--. Their covered required zeros are respectively {3,11}, {4,6,12}, {4,5,12}, {4,6}, {4,5}, {3}, {11}, {12}. This includes the legal alternative cube {0,1,2,3}; zero 3 is not restricted to pairing with 11.

6. Every clause must avoid all required one-codes. No single zero cube can cover any pair among required zeros 5,6,11: the smallest cube spanning each such pair contains code 7, a required one. At least three clauses are therefore necessary. The maximal cubes listed above have at most four cells, so every nonredundant clause has at least two literals. A cube covering zero 11 has at most two cells (the only choices are -011 and 1-11), so its clause needs at least three literals. Any POS consequently needs at least 3+2+2=7 literals; four or more clauses need at least eight. The displayed three-clause, seven-literal POS attains both lower bounds. Other minimum covers exist; its three chosen prime groups are not all essential.

Original paper, page 8

Descriptive
Report issue

BCD modulo-six truth table

Binary Codes & Error Detection

Question 9(a), GATE 2000: Convert one valid BCD digit d∈{0,…,9} to d mod 6. Input bits I₄I₃I₂I₁ have weights 8,4,2,1; output bits R₃R₂R₁ have weights 4,2,1. Illegal BCD inputs need not be detected.

Task: Give the complete valid-input truth table, using 1 for truth.
Question 9(a), GATE 2000: Convert one valid BCD digit d∈{0,…,9} to d mod 6. Input bits I₄I₃I₂I₁ have weights 8,4,2,1; output bits R₃R₂R₁ have weights 4,2,1. Illegal BCD inputs need not be detected.

Task: Give the complete valid-input truth table, using 1 for truth.
Tap to enlarge
Shared context

Convert one valid BCD digit d∈{0,…,9} to d mod 6. Input bits I₄I₃I₂I₁ have weights 8,4,2,1; output bits R₃R₂R₁ have weights 4,2,1. Illegal BCD inputs need not be detected.

Answer & solution

Answer: Outputs for inputs 0…9: 000,001,010,011,100,101,000,001,010,011. (no official key was published)

1. For d=0,…,5 the output equals d. For d=6,…,9 subtract six once, giving 0,1,2,3.

2. Table (decimal d: I₄I₃I₂I₁ → R₃R₂R₁): 0:0000→000; 1:0001→001; 2:0010→010; 3:0011→011; 4:0100→100; 5:0101→101; 6:0110→000; 7:0111→001; 8:1000→010; 9:1001→011.

3. Inputs 1010,1011,1100,1101,1110,1111 may all be assigned XXX (don’t-care), not mandatory zero. No fourth output bit is needed because the maximum remainder is 5; if a four-bit interface is desired, R₄=0 for valid inputs.

4. In particular parity is unchanged by subtracting six, so the least significant bit is simply R₁=I₁. This provides a useful check on every row.

Original paper, page 7

Descriptive
Report issue

Gate-level modulo-six converter

Binary Codes & Error Detection

Question 9(b), GATE 2000: Convert one valid BCD digit d∈{0,…,9} to d mod 6. Input bits I₄I₃I₂I₁ have weights 8,4,2,1; output bits R₃R₂R₁ have weights 4,2,1. Illegal BCD inputs need not be detected. Available altogether: two two-input AND gates, one two-input OR gate, and two NOT gates (OR is explicit in GFG; omitted in GateForum).

Task: Specify one circuit for each output bit within the gate budget.
Question 9(b), GATE 2000: Convert one valid BCD digit d∈{0,…,9} to d mod 6. Input bits I₄I₃I₂I₁ have weights 8,4,2,1; output bits R₃R₂R₁ have weights 4,2,1. Illegal BCD inputs need not be detected. Available altogether: two two-input AND gates, one two-input OR gate, and two NOT gates (OR is explicit in GFG; omitted in GateForum).

Task: Specify one circuit for each output bit within the gate budget.
Question 9(b), GATE 2000: Convert one valid BCD digit d∈{0,…,9} to d mod 6. Input bits I₄I₃I₂I₁ have weights 8,4,2,1; output bits R₃R₂R₁ have weights 4,2,1. Illegal BCD inputs need not be detected. Available altogether: two two-input AND gates, one two-input OR gate, and two NOT gates (OR is explicit in GFG; omitted in GateForum).

Task: Specify one circuit for each output bit within the gate budget.
Tap to enlarge
Shared context

Convert one valid BCD digit d∈{0,…,9} to d mod 6. Input bits I₄I₃I₂I₁ have weights 8,4,2,1; output bits R₃R₂R₁ have weights 4,2,1. Illegal BCD inputs need not be detected.

Answer & solution

Answer: R₁=I₁; R₂=(I₂∧¬I₃)∨I₄; R₃=I₃∧¬I₂. (no official key was published)

1. R₃ must be one only for valid digits 4 and 5. Their I₃=1 and I₂=0, so R₃=I₃ AND NOT I₂. Illegal inputs are don’t-care, permitting this simple expression.

2. R₂ is one for 2,3,8,9. The term I₂ AND NOT I₃ covers 2,3; I₄ covers 8,9 among valid BCD digits. Therefore R₂=(I₂ AND NOT I₃) OR I₄.

3. Complete netlist: N₂=NOT(I₂); N₃=NOT(I₃); G₂=AND(I₂,N₃); G₃=AND(I₃,N₂); R₂=OR(G₂,I₄); R₃=G₃; R₁ is a wire from I₁. This explicitly identifies every gate input and output and uses exactly the allowed 2 NOT, 2 AND, 1 OR gates.

4. Checking d=6,7 gives I₃=I₂=1, so R₃=R₂=0 and only parity R₁ remains. Checking d=8,9 gives I₄=1 and I₃=I₂=0, so output is 010 or 011. These are the nontrivial modulo reductions.

5. R₃ is the weight-four bit, not R₄. If four output positions are drawn, tie R₄ to zero.

Original paper, page 7

5 marks · Descriptive
Report issue

Hamming (7,4) syndrome

Binary Codes & Error Detection

Question 9, GATE 1994: A received seven-bit single-error-correcting Hamming word has positions 7,6,5,4,3,2,1 containing 1,0,0,0,1,1,0 respectively. Assuming at most one corrupted bit, determine correctness and, if needed, correct it.
Tap to enlarge
Answer & solution

Answer: Even parity: bit 6 is wrong, corrected word 1100110. Odd parity: bit 1 is wrong, corrected word 1000111. (no official key was published)

1. Parity checks cover positions {1,3,5,7}, {2,3,6,7}, {4,5,6,7}. Their received XORs are 0,1,1.

2. For even parity each expected XOR is zero. The failure vector (s4,s2,s1)=110₂=6 locates bit 6; flip its 0 to 1 to obtain 1100110 in position order 7 through 1. All three checks then equal zero.

3. For odd parity each expected XOR is one. The failure vector is 001₂=1, so flip bit 1 from 0 to 1 to obtain 1000111 in position order 7 through 1. All three checks then equal one.

4. Because the source does not specify the parity convention, one cannot select a unique corrected word without stating an assumption.

Diagram / structural description

Position: 7 6 5 4 3 2 1
Received: 1 0 0 0 1 1 0

  • Neither the paper explicitly specifies even or odd parity.

Original paper, page 5