Chapter 1 · 3 hours
Introduction
IOE past exam questions
Past questions and answers
62 questions set from this chapter, 5 of them more than once. Most asked first.
- Asked 4 times
- 2078 Kartik · 3 marks
- 2078 Bhadra · 1.5 marks
- 2075 Chaitra · 2.5 marks
- 2068 Chaitra · 6 marks
Explain Excess-3 code with suitable examples.
Answer
Excess-3 (XS-3) code is a non-weighted BCD code in which each decimal digit is coded as the 4-bit binary of (digit + 3). It was used in early computers and calculators because it makes decimal arithmetic easier.
Excess-3 table
| Decimal | BCD (8421) | Excess-3 |
|---|---|---|
| 0 | 0000 | 0011 |
| 1 | 0001 | 0100 |
| 2 | 0010 | 0101 |
| 3 | 0011 | 0110 |
| 4 | 0100 | 0111 |
| 5 | 0101 | 1000 |
| 6 | 0110 | 1001 |
| 7 | 0111 | 1010 |
| 8 | 1000 | 1011 |
| 9 | 1001 | 1100 |
Codes 0000, 0001, 0010, 1101, 1110, 1111 are invalid (unused).
How to convert
Add 3 to each decimal digit separately, then write each result in 4-bit binary.
Example 1:
- 3 + 3 = 6 → 0110
- 9 + 3 = 12 → 1100
Example 2:
- 2 → 0101, 5 → 1000, 8 → 1011
Properties
- Unweighted code: bit positions have no fixed weights.
- Self-complementing: the 9's complement of a digit is obtained by simply inverting all bits. For example, 4 = 0111; inverting gives 1000 = 5 in XS-3, and . This made subtraction simple in old machines.
- No all-zero code: every valid code has at least one 1, which helps detect a dead line.
- Easy addition: when two XS-3 digits are added, a carry occurs exactly when the decimal sum exceeds 9. Correction: if there is a carry, add 0011 to the digit; if no carry, subtract 0011.
Addition example:
- , no carry
- subtract 0011: = 9 in XS-3
Excess-3 is therefore a convenient BCD code for decimal arithmetic, though it needs more bits than pure binary.
- Asked 4 times
- 2081 Bhadra · 3 marks
- 2080 Bhadra · 3 marks
- 2078 Kartik · 3 marks
- 2076 Asoj · 3 marks
List the advantages of digital signal over analog signal.
Answer
A digital signal has only a finite set of discrete levels (usually 0 and 1), while an analog signal varies continuously. Digital signals have these advantages:
- Noise immunity: small noise does not change a 0 into a 1, so the signal is received correctly. Analog signals are corrupted by every bit of noise.
- Regeneration: a digital signal can be fully restored by repeaters, so noise does not accumulate over long distances.
- Easy storage: data can be stored in memory, discs and flash without loss of quality, and copied any number of times exactly.
- Easy processing: digital data can be processed by computers and microprocessors using software.
- Error detection and correction: parity bits and codes (Hamming, CRC) can find and fix errors.
- Encryption and compression are easy to apply.
- Accuracy and precision are set by the number of bits, and do not drift with temperature or ageing.
- Design and integration: digital circuits are easy to design and fit in ICs with millions of gates, giving low cost and small size.
- Multiplexing: many digital signals (voice, video, data) share one channel easily (TDM).
Example: a song copied many times on an audio cassette (analog) becomes noisy, but an MP3 file copied many times stays exactly the same.
- Asked 3 times
- 2078 Bhadra · 1.5 marks
- 2076 Chaitra · 3 marks
- 2074 Chaitra · 2 marks
Explain Gray code with suitable examples.
Answer
Gray code is an unweighted binary code in which two successive numbers differ in only one bit. It is also called the reflected binary code or a unit-distance code.
4-bit Gray code table
| Decimal | Binary | Gray | Decimal | Binary | Gray |
|---|---|---|---|---|---|
| 0 | 0000 | 0000 | 8 | 1000 | 1100 |
| 1 | 0001 | 0001 | 9 | 1001 | 1101 |
| 2 | 0010 | 0011 | 10 | 1010 | 1111 |
| 3 | 0011 | 0010 | 11 | 1011 | 1110 |
| 4 | 0100 | 0110 | 12 | 1100 | 1010 |
| 5 | 0101 | 0111 | 13 | 1101 | 1011 |
| 6 | 0110 | 0101 | 14 | 1110 | 1001 |
| 7 | 0111 | 0100 | 15 | 1111 | 1000 |
Binary to Gray
MSB stays the same; each next Gray bit = XOR of the current and previous binary bits: .
Example: → G = 1, 1⊕0 = 1, 0⊕1 = 1, 1⊕1 = 0 → .
Gray to binary
MSB stays the same; each next binary bit = previous binary bit XOR current Gray bit: .
Example: → B = 1, 1⊕1 = 0, 0⊕1 = 1, 1⊕0 = 1 → .
Uses
- Shaft position (rotary) encoders: only one bit changes per step, so no false reading at transitions.
- K-map labelling (00, 01, 11, 10).
- Reducing switching errors in counters and ADCs.
- Asked 2 times
- 2078 Bhadra · 1.5 marks
- 2075 Asoj · 5 marks
Explain BCD code with suitable examples.
Answer
BCD (Binary Coded Decimal) is a code in which each decimal digit (0–9) is represented separately by its 4-bit binary equivalent. It is also called the 8421 code, since the four bits have weights 8, 4, 2 and 1.
BCD table
| Decimal | BCD | Decimal | BCD |
|---|---|---|---|
| 0 | 0000 | 5 | 0101 |
| 1 | 0001 | 6 | 0110 |
| 2 | 0010 | 7 | 0111 |
| 3 | 0011 | 8 | 1000 |
| 4 | 0100 | 9 | 1001 |
The six combinations 1010 to 1111 are invalid in BCD.
Examples
- = 0010 0101 1001 (BCD)
- = 0100 0111 (BCD), whereas in pure binary .
- BCD 1001 0011 = .
BCD addition
Add the digits in binary. If the 4-bit sum is greater than 1001 (9) or a carry is produced, add 0110 (6) to correct it.
Example:
0111 (7)
+ 0101 (5)
------
1100 invalid (>9)
+ 0110 add 6
------
1 0010 -> 0001 0010 = 12
Advantages
- Easy conversion between decimal and BCD; ideal for displays (7-segment), calculators, digital clocks and meters.
- Decimal fractions such as 0.1 are exact.
Disadvantages
- Needs more bits than pure binary (e.g. 99 needs 8 bits in BCD, 7 in binary), so storage is wasted.
- Arithmetic is more complex because of correction steps.
- Six of the 16 combinations are unused.
- Asked 2 times
- 2081 Baisakh · 2 marks
- 2078 Bhadra · 1.5 marks
Explain ASCII code with examples.
Answer
ASCII (American Standard Code for Information Interchange) is a 7-bit alphanumeric code that represents characters: letters, digits, punctuation and control codes. It is the standard code for text in computers and for data exchange between devices.
Groups of characters
- 0–31 and 127: control characters (e.g. LF = 10, CR = 13, ESC = 27, DEL = 127).
- 32: space; 33–47 etc.: punctuation and symbols.
- 48–57: digits '0'–'9' (011 0000 to 011 1001).
- 65–90: capital letters 'A'–'Z'; 97–122: small letters 'a'–'z'.
Examples
| Character | Decimal | Hex | 7-bit ASCII |
|---|---|---|---|
| A | 65 | 41 | 100 0001 |
| C | 67 | 43 | 100 0011 |
| a | 97 | 61 | 110 0001 |
| 0 | 48 | 30 | 011 0000 |
| Space | 32 | 20 | 010 0000 |
So "CAT" is stored as 43H 41H 54H. Lower-case letters are 32 (bit 5) higher than capitals. An 8th bit is often added as a parity bit or for the extended ASCII set (256 characters).
- 2081 Bhadra · 2+4 marks
What is a BCD code? Design a 3-bit binary to Gray code converter.
Answer
BCD code
BCD (Binary Coded Decimal) represents each decimal digit separately by its 4-bit binary value (8421 weights). Only 0000–1001 are valid; 1010–1111 are invalid. Example: = 1001 0011 (BCD), while in binary . BCD is used in calculators, clocks and 7-segment displays.
3-bit binary to Gray code converter
Inputs: binary ( = MSB). Outputs: Gray . In Gray code, successive values differ in only one bit.
Truth table (3-bit binary to Gray)
| 0 | 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 | 0 | 1 |
| 0 | 1 | 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 | 1 | 0 |
| 1 | 0 | 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 1 | 1 | 1 |
| 1 | 1 | 0 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 | 0 | 0 |
Simplification (K-maps)
K-map for (rows , columns ):
B1B0
B2 00 01 11 10
0 | 0 | 0 | 1 | 1 |
1 | 1 | 1 | 0 | 0 |
Logic circuit
B2 ---+------------------------ G2
| +-------+
+--->| |
| XOR |----------- G1
B1 ---+--->| |
| +-------+
| +-------+
+--->| |
| XOR |----------- G0
B0 ------->| |
+-------+
The converter needs only two XOR gates: the MSB passes straight through and each other Gray bit is the XOR of two neighbouring binary bits.
- 2081 Baisakh · 2+2+3 marks
Convert decimal 39 into Gray code and Excess-3 code. Use 2's complement method to perform the following addition (-28+17)₁₀.
Answer
Decimal 39 to Gray code
First convert to binary by repeated division by 2:
| Division | Quotient | Remainder |
|---|---|---|
| 39 ÷ 2 | 19 | 1 |
| 19 ÷ 2 | 9 | 1 |
| 9 ÷ 2 | 4 | 1 |
| 4 ÷ 2 | 2 | 0 |
| 2 ÷ 2 | 1 | 0 |
| 1 ÷ 2 | 0 | 1 |
Reading upwards: .
Binary to Gray (keep MSB, then XOR adjacent bits):
Binary : 1 0 0 1 1 1
| / \ / \ / \ / \ /
Gray : 1 1 0 1 0 0
Answer:
Decimal 39 to Excess-3
Add 3 to each digit: 3 + 3 = 6 → 0110; 9 + 3 = 12 → 1100.
Answer:
(−28) + (17) using 2's complement (8-bit)
- 1's complement: ; add 1 →
1110 0100 (-28)
+ 0001 0001 (+17)
-----------
1111 0101 no end carry
No end carry, so the result is negative and in 2's complement form. Take the 2's complement to find its magnitude: .
Answer:
- 2080 Bhadra · 2+3+1 marks
Define Gray Code. Design 3-bit binary to gray code converter circuit with necessary truth table and circuit diagram.
Answer
Gray code
Gray code is an unweighted, reflected binary code in which successive numbers differ in only one bit position. Examples: 0 = 000, 1 = 001, 2 = 011, 3 = 010. It is used in shaft encoders and K-maps because only one bit changes at each step, avoiding false intermediate values.
3-bit binary to Gray code converter
Inputs: (binary, = MSB). Outputs: .
Truth table (3-bit binary to Gray)
| 0 | 0 | 0 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 | 0 | 1 |
| 0 | 1 | 0 | 0 | 1 | 1 |
| 0 | 1 | 1 | 0 | 1 | 0 |
| 1 | 0 | 0 | 1 | 1 | 0 |
| 1 | 0 | 1 | 1 | 1 | 1 |
| 1 | 1 | 0 | 1 | 0 | 1 |
| 1 | 1 | 1 | 1 | 0 | 0 |
Simplification (K-maps)
K-map for (rows , columns ):
B1B0
B2 00 01 11 10
0 | 0 | 0 | 1 | 1 |
1 | 1 | 1 | 0 | 0 |
Logic circuit
B2 ---+------------------------ G2
| +-------+
+--->| |
| XOR |----------- G1
B1 ---+--->| |
| +-------+
| +-------+
+--->| |
| XOR |----------- G0
B0 ------->| |
+-------+
The converter needs only two XOR gates: the MSB passes straight through and each other Gray bit is the XOR of two neighbouring binary bits.
- 2080 Baisakh · 2+2+4 marks
Perform the following: (i) (1110)gray = ( )BCD (ii) (1430)₁₀ = ( )excess-3 (iii) Use 2's complement method to perform the addition (-28 +17).
Answer
(i) to BCD
Gray to binary: MSB is copied; each next binary bit = previous binary bit XOR current Gray bit.
| Step | Gray bit | Binary bit |
|---|---|---|
| MSB | 1 | 1 |
| 2 | 1 | 1 ⊕ 1 = 0 |
| 3 | 1 | 0 ⊕ 1 = 1 |
| LSB | 0 | 1 ⊕ 0 = 1 |
. Each decimal digit in BCD: 1 → 0001, 1 → 0001.
Answer:
(ii) to Excess-3
Add 3 to each digit and write in 4 bits:
| Digit | +3 | XS-3 |
|---|---|---|
| 1 | 4 | 0100 |
| 4 | 7 | 0111 |
| 3 | 6 | 0110 |
| 0 | 3 | 0011 |
Answer:
(iii) (−28) + 17 using 2's complement (8 bits)
- 1's complement ; add 1:
1110 0100 (-28)
+ 0001 0001 (+17)
-----------
1111 0101 (no end carry)
The MSB is 1 and there is no end carry, so the result is negative in 2's complement form. Magnitude: 2's complement of = .
Check: .
Answer:
- 2079 Baisakh · 6 marks
Define Digital and analog Signal, Explain Gray and Excess 3 code with example.
Answer
Analog signal
An analog signal is a continuous signal that can take any value within a range at every instant of time, e.g. a sine wave, voice from a microphone, or temperature from a thermocouple.
Digital signal
A digital signal takes only a finite number of discrete values (usually two: 0 and 1) and changes only at discrete instants, e.g. the clock or data in a computer.
Analog : /\ /\ Digital: _ __ _
/ \ / \ | | | | | |
/ \/ \ __| |_| |__| |__
Gray code
Gray code is an unweighted, reflected binary code in which consecutive numbers differ in only one bit.
| Decimal | Binary | Gray |
|---|---|---|
| 0 | 000 | 000 |
| 1 | 001 | 001 |
| 2 | 010 | 011 |
| 3 | 011 | 010 |
| 4 | 100 | 110 |
| 5 | 101 | 111 |
| 6 | 110 | 101 |
| 7 | 111 | 100 |
Binary to Gray: keep MSB, then . Example: → 1, 1⊕0 = 1, 0⊕1 = 1, 1⊕1 = 0 → . Used in shaft encoders and K-maps.
Excess-3 code
Excess-3 is an unweighted BCD code where each decimal digit is coded as the binary of digit + 3.
| Decimal | 0 | 1 | 2 | 5 | 9 |
|---|---|---|---|---|---|
| XS-3 | 0011 | 0100 | 0101 | 1000 | 1100 |
Example: → 2+3 = 5 → 0101, 7+3 = 10 → 1010 → . It is self-complementing: inverting the bits gives the 9's complement (e.g. 2 = 0101 → 1010 = 7 = 9 − 2).
- 2079 Bhadra · 2+2+2 marks
What is a Gray code? How is it different than binary code? Convert (10110)₂ to Gray code?
Answer
Gray code
Gray code is an unweighted binary code in which two successive values differ in only one bit. It is also called the reflected binary code. Example sequence: 000, 001, 011, 010, 110, 111, 101, 100.
Difference from binary code
| Point | Binary code | Gray code |
|---|---|---|
| Weights | Weighted (1, 2, 4, 8…) | Unweighted |
| Bit change between successive numbers | One or more (011 → 100 changes 3 bits) | Exactly one |
| Arithmetic | Easy | Not suitable |
| Switching errors | Possible at transitions | Minimal |
| Uses | Computation, storage | Encoders, K-maps, ADCs |
Convert to Gray
Keep the MSB; each following Gray bit is the XOR of two adjacent binary bits.
Binary: 1 0 1 1 0
| \ | \ | \ | \ |
Gray : 1 1 1 0 1
Answer:
- 2078 Kartik · 2+2+2 marks
Perform the following code conversions: (i) (41.8125)₁₀ = (?)₂ (ii) (1000)₂ = (?)BCD (iii) (19)₁₀ = (?)Ex-3 code
Answer
(i) to binary
Integer part (repeated division by 2):
| Division | Quotient | Remainder |
|---|---|---|
| 41 ÷ 2 | 20 | 1 |
| 20 ÷ 2 | 10 | 0 |
| 10 ÷ 2 | 5 | 0 |
| 5 ÷ 2 | 2 | 1 |
| 2 ÷ 2 | 1 | 0 |
| 1 ÷ 2 | 0 | 1 |
Reading upwards: .
Fraction part (repeated multiplication by 2):
| Multiplication | Result | Integer bit |
|---|---|---|
| 0.8125 × 2 | 1.625 | 1 |
| 0.625 × 2 | 1.25 | 1 |
| 0.25 × 2 | 0.5 | 0 |
| 0.5 × 2 | 1.0 | 1 |
Reading downwards: .
Answer:
(ii) to BCD
, and the digit 8 in BCD is 1000.
Answer: (for a two-digit view, 0000 1000)
(iii) to Excess-3
Add 3 to each digit: 1 + 3 = 4 → 0100; 9 + 3 = 12 → 1100.
Answer:
- 2078 Bhadra · 1+3 marks
What is BCD code? List the advantages and disadvantages of BCD code.
Answer
BCD (Binary Coded Decimal) is a code in which each decimal digit 0–9 is represented by its own 4-bit binary value with weights 8-4-2-1. Codes 1010–1111 are invalid. Example: = 0101 0111 (BCD).
Advantages
- Very easy conversion between decimal and BCD, as each digit is coded separately.
- Suitable for decimal displays (7-segment), calculators, digital clocks and meters, where numbers are shown to people.
- Decimal fractions such as 0.1 are represented exactly, so it is used in financial calculations.
- Easy to scale by powers of 10 (shift by one digit).
Disadvantages
- Needs more bits than pure binary: needs 8 bits in BCD but only 7 in binary; storage is wasted.
- Six of the 16 4-bit combinations are unused.
- Arithmetic is more complex: after binary addition a correction (add 0110) is needed when a digit exceeds 9.
- Circuits for BCD arithmetic are slower and more complex than binary circuits.
- 2076 Asoj · 3 marks
What is a gray code? Compare with binary numbers.
Answer
Gray code is an unweighted, reflected binary code in which successive numbers differ in only one bit position. It is used in shaft position encoders, K-maps and ADCs to avoid errors during transitions.
| Decimal | Binary | Gray |
|---|---|---|
| 0 | 000 | 000 |
| 1 | 001 | 001 |
| 2 | 010 | 011 |
| 3 | 011 | 010 |
| 4 | 100 | 110 |
| 5 | 101 | 111 |
| 6 | 110 | 101 |
| 7 | 111 | 100 |
Comparison with binary numbers
| Point | Binary | Gray |
|---|---|---|
| Type | Weighted (positional) | Unweighted |
| Change between successive values | Many bits may change (3 → 4: 011 → 100) | Only one bit changes |
| Arithmetic | Easy to add and subtract | Not suitable for arithmetic |
| Error at transitions | False readings possible | Very small error |
| Conversion | — |
Example: → Gray .
- 2075 Asoj · 2+4 marks
Describe in your own words the characteristics of an analog and a digital signal. Convert A2.64H into its octal and decimal equivalents.
Answer
Characteristics of analog and digital signals
| Analog signal | Digital signal |
|---|---|
| Continuous in time and amplitude | Discrete levels (usually 0 and 1) |
| Infinite possible values in a range | Finite set of values |
| Example: sine wave, voice | Example: clock pulses, computer data |
| Easily affected by noise | High noise immunity |
| Hard to store without loss | Stored and copied exactly |
Convert to octal
Write each hex digit in 4 bits:
Regroup into 3-bit groups from the binary point (left for integer, right for fraction), padding with zeros:
Integer : 010 100 010 -> 2 4 2
Fraction: 011 001 000 -> 3 1 0
Answer:
Convert to decimal
Check from octal: .
Answer:
- 2074 Chaitra · 3 marks
Convert 37.432 decimal number to binary.
Answer
Convert the integer and fraction parts separately.
Integer part: 37
| Division | Quotient | Remainder |
|---|---|---|
| 37 ÷ 2 | 18 | 1 |
| 18 ÷ 2 | 9 | 0 |
| 9 ÷ 2 | 4 | 1 |
| 4 ÷ 2 | 2 | 0 |
| 2 ÷ 2 | 1 | 0 |
| 1 ÷ 2 | 0 | 1 |
Reading upwards: .
Fraction part: 0.432
| Multiplication | Result | Bit |
|---|---|---|
| 0.432 × 2 | 0.864 | 0 |
| 0.864 × 2 | 1.728 | 1 |
| 0.728 × 2 | 1.456 | 1 |
| 0.456 × 2 | 0.912 | 0 |
| 0.912 × 2 | 1.824 | 1 |
| 0.824 × 2 | 1.648 | 1 |
| 0.648 × 2 | 1.296 | 1 |
| 0.296 × 2 | 0.592 | 0 |
| 0.592 × 2 | 1.184 | 1 |
| 0.184 × 2 | 0.368 | 0 |
The fraction does not terminate, so we stop after 10 bits. Reading downwards: .
Answer:
Check: , very close to 37.432.
- 2074 Asoj · 2+3 marks
Convert decimal 39 into binary and hexadecimal. Use 2's complement method to perform the following addition (-28+17).
Answer
Decimal 39 to binary
| Division | Quotient | Remainder |
|---|---|---|
| 39 ÷ 2 | 19 | 1 |
| 19 ÷ 2 | 9 | 1 |
| 9 ÷ 2 | 4 | 1 |
| 4 ÷ 2 | 2 | 0 |
| 2 ÷ 2 | 1 | 0 |
| 1 ÷ 2 | 0 | 1 |
Answer:
Decimal 39 to hexadecimal
39 ÷ 16 = 2 remainder 7, and 2 ÷ 16 = 0 remainder 2. (Check: group binary 0010 0111 → 2 7.)
Answer:
(−28) + 17 using 2's complement (8 bits)
- 1's complement: ; add 1 →
1110 0100 (-28)
+ 0001 0001 (+17)
-----------
1111 0101 no end carry
No end carry and MSB = 1, so the answer is negative in 2's complement form. Its magnitude is the 2's complement: .
Answer:
- 2073 Shrawan · 3+2 marks
Perform the following code conversions: i) (1110)gray = (?)BCD ii) (1430)₁₀ = (?)Excess-3
Answer
(i) to BCD
Step 1: Gray to binary. Copy the MSB; each next binary bit = previous binary bit ⊕ current Gray bit.
| Gray bit | Operation | Binary bit |
|---|---|---|
| 1 (MSB) | copy | 1 |
| 1 | 1 ⊕ 1 | 0 |
| 1 | 0 ⊕ 1 | 1 |
| 0 | 1 ⊕ 0 | 1 |
Step 2: decimal to BCD. Code each digit: 1 → 0001, 1 → 0001.
Answer:
(ii) to Excess-3
Add 3 to each digit and write it in 4 bits:
| Digit | Digit + 3 | Excess-3 |
|---|---|---|
| 1 | 4 | 0100 |
| 4 | 7 | 0111 |
| 3 | 6 | 0110 |
| 0 | 3 | 0011 |
Answer:
- 2072 Chaitra · 2 marks
Convert (10.0101)₂ = (?)₁₆.
Answer
Group the bits in fours starting from the binary point: to the left for the integer part and to the right for the fraction, padding with zeros.
Integer : 10 -> 0010 -> 2
Fraction: .0101 -> 0101 -> 5
Check in decimal: , and .
Answer:
- 2072 Chaitra · 2 marks
Convert (101001001)binary = (?)Gray.
Answer
Rule: the MSB of the Gray code equals the MSB of binary; every other Gray bit is the XOR of the corresponding binary bit and the bit to its left: .
| Binary pair | XOR | Gray bit |
|---|---|---|
| MSB 1 | copy | 1 |
| 1, 0 | 1 ⊕ 0 | 1 |
| 0, 1 | 0 ⊕ 1 | 1 |
| 1, 0 | 1 ⊕ 0 | 1 |
| 0, 0 | 0 ⊕ 0 | 0 |
| 0, 1 | 0 ⊕ 1 | 1 |
| 1, 0 | 1 ⊕ 0 | 1 |
| 0, 0 | 0 ⊕ 0 | 0 |
| 0, 1 | 0 ⊕ 1 | 1 |
Answer:
- 2072 Chaitra · 2 marks
Convert (93)₁₀ = (?)Excess-3.
Answer
In Excess-3 code each decimal digit is coded separately as the 4-bit binary of (digit + 3).
| Digit | Digit + 3 | Excess-3 |
|---|---|---|
| 9 | 12 | 1100 |
| 3 | 6 | 0110 |
Answer:
- 2070 Chaitra · 1+5 marks
Define digital signal and explain Gray code with example.
Answer
Digital signal
A digital signal is a signal that has only a finite number of discrete values (usually two levels, 0 and 1) and changes at discrete instants of time. Example: clock pulses and data in a computer.
Gray code
Gray code is an unweighted binary code in which two consecutive numbers differ in only one bit. It is also called the reflected binary code, because the code for bits is built by writing the -bit code, reflecting it like a mirror, and prefixing 0 to the top half and 1 to the bottom half.
1-bit 2-bit 3-bit
0 00 000
1 01 001
--- 11 011
mirror 10 010
---- 110
mirror 111
101
100
| Decimal | Binary | Gray |
|---|---|---|
| 0 | 000 | 000 |
| 1 | 001 | 001 |
| 2 | 010 | 011 |
| 3 | 011 | 010 |
| 4 | 100 | 110 |
| 5 | 101 | 111 |
| 6 | 110 | 101 |
| 7 | 111 | 100 |
Binary to Gray: keep the MSB; . Example: → 1, 1⊕1 = 0, 1⊕0 = 1, 0⊕1 = 1 → .
Gray to binary: keep the MSB; . Example: → 1, 1⊕0 = 1, 1⊕1 = 0, 0⊕1 = 1 → .
Features and uses
- Unweighted, so not used for arithmetic.
- Only one bit changes per step, so it avoids false readings in rotary shaft encoders.
- Used to label K-map rows and columns (00, 01, 11, 10).
- Used in ADCs and low-power counters.
- 2069 Chaitra · 3+3 marks
Define digital IC signal levels. What is Gray Code? Explain with example.
Answer
Digital IC signal levels
Digital IC signal levels are the voltage ranges that an IC family accepts or produces as logic 0 (LOW) and logic 1 (HIGH). Any voltage in the forbidden band between them is not a valid logic level. For standard TTL (5 V supply):
| Parameter | Meaning | TTL value |
|---|---|---|
| Highest input read as 0 | 0.8 V | |
| Lowest input read as 1 | 2.0 V | |
| Highest output for 0 | 0.4 V | |
| Lowest output for 1 | 2.4 V |
5.0 V +--------------+
| logic 1 | input HIGH: 2.0 to 5 V
2.0 V +--------------+
| forbidden |
0.8 V +--------------+
| logic 0 | input LOW: 0 to 0.8 V
0 V +--------------+
Noise margin = V (same for LOW: V). For 5 V CMOS, typical levels are V and V.
Gray code
Gray code is an unweighted, reflected binary code in which successive numbers differ in only one bit.
| Decimal | Binary | Gray |
|---|---|---|
| 0 | 000 | 000 |
| 1 | 001 | 001 |
| 2 | 010 | 011 |
| 3 | 011 | 010 |
| 4 | 100 | 110 |
| 5 | 101 | 111 |
| 6 | 110 | 101 |
| 7 | 111 | 100 |
Binary to Gray: keep MSB, then . Example: → 1, 1⊕0 = 1, 0⊕0 = 0, 0⊕1 = 1 → . It is used in shaft encoders and K-maps because only one bit changes per step.
- 2082 Shrawan · 1 mark
Convert (41A.2D)₁₆ = (?)₈.
Answer
Convert hex to binary (4 bits per digit), then regroup in 3 bits from the point.
Integer : 010 000 011 010 -> 2 0 3 2
Fraction: 001 011 010 -> 1 3 2
Answer:
- 2082 Shrawan · 1 mark
Convert (37.85)₁₀ = (?)₈.
Answer
Integer part: 37 ÷ 8 = 4 r 5; 4 ÷ 8 = 0 r 4 → .
Fraction part (multiply by 8):
| Step | Result | Digit |
|---|---|---|
| 0.85 × 8 | 6.8 | 6 |
| 0.8 × 8 | 6.4 | 6 |
| 0.4 × 8 | 3.2 | 3 |
| 0.2 × 8 | 1.6 | 1 |
| 0.6 × 8 | 4.8 | 4 |
The digits then repeat (6, 3, 1, 4, …).
Answer:
- 2082 Shrawan · 1 mark
Convert (19)₁₀ = (?)Gray.
Answer
First (16 + 2 + 1). Then keep the MSB and XOR adjacent bits:
Answer:
- 2082 Shrawan · 1 mark
Convert (1100 0011)Excess-3 = (?)BCD.
Answer
Subtract 3 (0011) from each 4-bit group to get the decimal digit, then write it in BCD.
| XS-3 group | − 3 | Digit | BCD |
|---|---|---|---|
| 1100 (12) | 9 | 9 | 1001 |
| 0011 (3) | 0 | 0 | 0000 |
Answer:
- 2082 Shrawan · 2+6 marks
Define an ASCII code. Design a binary to excess-3 code converter circuit using basic gates.
Answer
ASCII code
ASCII (American Standard Code for Information Interchange) is a 7-bit alphanumeric code that represents 128 characters: letters, digits, symbols and control characters. Example: 'A' = 65 = 100 0001, 'a' = 97 = 110 0001, '0' = 48 = 011 0000.
Binary (BCD) to Excess-3 code converter
Inputs: 4-bit binary/BCD digit ( = MSB), valid 0–9. Outputs: Excess-3 code = input + 3. Inputs 10–15 never occur, so they are don't cares (X).
| Dec | A | B | C | D | W | X | Y | Z |
|---|---|---|---|---|---|---|---|---|
| 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |
| 1 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 |
| 2 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 |
| 3 | 0 | 0 | 1 | 1 | 0 | 1 | 1 | 0 |
| 4 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 1 |
| 5 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 0 |
| 6 | 0 | 1 | 1 | 0 | 1 | 0 | 0 | 1 |
| 7 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 0 |
| 8 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 1 |
| 9 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 |
K-map simplification
Minterms (don't cares –):
K-map for (rows , columns ):
CD
AB 00 01 11 10
00 | 0 | 0 | 0 | 0 |
01 | 0 | 1 | 1 | 1 |
11 | X | X | X | X |
10 | 1 | 1 | X | X |
Groups: (rows 11 and 10), , .
Simplified expressions:
(All ten rows of the table were checked against these equations.)
Logic circuit (basic gates)
A ----------------------------+
B --+--[AND]-- BC ------------+--[OR]--- W
C --+ |
B --+--[AND]-- BD ------------+
D --+
B'--+--[AND]-- B'C -----------+
C --+ |
B'--+--[AND]-- B'D -----------+--[OR]--- X
D --+ |
B --+ |
C'--+--[AND]-- BC'D' ---------+
D'--+
C --+--[AND]-- CD ------------+--[OR]--- Y
D --+ |
C'--+--[AND]-- C'D' ----------+
D'--+
D ----[NOT]---------------------------- Z
NOT gates generate , , . The circuit uses 7 AND gates, 3 OR gates and 4 NOT gates (three for the complements, one for Z).
- 2082 Baisakh · 1+1+3 marks
Define digital system and logic level. What is the difference between BCD and binary codes?
Answer
Digital system
A digital system is a system that processes information in discrete form, usually as binary signals 0 and 1, e.g. a computer, calculator or digital watch.
Logic level
A logic level is one of the discrete voltage states used to represent a binary value: HIGH (logic 1) and LOW (logic 0). For TTL, an input of 2.0–5 V is HIGH and 0–0.8 V is LOW.
BCD vs binary code
| Point | Binary code | BCD code |
|---|---|---|
| Method | Whole number converted to base 2 | Each decimal digit coded separately in 4 bits |
| Example: 25 | 11001 | 0010 0101 |
| Bits needed | Fewer (efficient) | More (e.g. 99 needs 8 bits vs 7) |
| Unused codes | None | 1010–1111 invalid |
| Arithmetic | Simple | Needs correction (add 0110) |
| Conversion to decimal | Lengthy | Very easy |
| Use | Computation, memory | Displays, calculators, clocks |
- 2082 Baisakh · 3 marks
Convert Octal (623.77) to decimal, binary and hexadecimal.
Answer
To decimal
Decimal:
To binary
Replace each octal digit by 3 bits: 6 = 110, 2 = 010, 3 = 011, 7 = 111, 7 = 111.
Binary:
To hexadecimal
Regroup the binary into 4 bits from the point:
Integer : 0001 1001 0011 -> 1 9 3
Fraction: 1111 1100 -> F C
Hexadecimal: (check: )
- 2081 Bhadra · 6 marks
Convert the following number system: i) (21)₈ = (?)₂ ii) (671)₁₀ = (?)BCD iii) (110101.011)₂ = (?)₁₀
Answer
(i) to binary
Write each octal digit in 3 bits: 2 = 010, 1 = 001.
= (check: ).
(ii) to BCD
Code each decimal digit in 4 bits:
| Digit | 6 | 7 | 1 |
|---|---|---|---|
| BCD | 0110 | 0111 | 0001 |
Answer:
(iii) to decimal
Answer:
- 2081 Baisakh · 2+4 marks
Differentiate between discrete and continuous signal with necessary figures and example. Convert (25.25)₁₀ to binary and octal equivalent.
Answer
Discrete vs continuous signal
A continuous (analog) signal is defined at every instant of time and can take any value in a range. A discrete-time signal is defined only at specific (sampled) instants; if its values are also limited to fixed levels, it is a digital signal.
Continuous x(t) Discrete x[n]
__ | |
/ \ / | | | |
/ \ / | | | | |
/ \__/ ---+-+--+-+--+--- n
---------------- t 0 1 2 3 4
| Continuous signal | Discrete signal |
|---|---|
| Defined for all time | Defined only at |
| Written | Written |
| Example: voice, temperature | Example: daily rainfall, sampled audio |
| Processed by analog circuits | Processed by digital systems |
Convert to binary
Integer: 25 → 25/2 = 12 r1, 12/2 = 6 r0, 6/2 = 3 r0, 3/2 = 1 r1, 1/2 = 0 r1 → . Fraction: 0.25 × 2 = 0.5 → 0; 0.5 × 2 = 1.0 → 1 → .
Answer:
Convert to octal
Integer: 25 ÷ 8 = 3 r 1; 3 ÷ 8 = 0 r 3 → . Fraction: 0.25 × 8 = 2.0 → 2. (Check by grouping binary: 011 001 . 010 → 3 1 . 2.)
Answer:
- 2080 Bhadra · 1.5 marks
Convert (26.75)₁₀ = (?)₂.
Answer
Integer: 26 ÷ 2 = 13 r0, 13 ÷ 2 = 6 r1, 6 ÷ 2 = 3 r0, 3 ÷ 2 = 1 r1, 1 ÷ 2 = 0 r1 → read upwards: .
Fraction: 0.75 × 2 = 1.5 → 1; 0.5 × 2 = 1.0 → 1 → .
Answer:
- 2080 Bhadra · 1.5 marks
Convert (36.735)₈ = (?)₁₀.
Answer
Answer:
- 2080 Bhadra · 1.5 marks
Convert (10101)gray = (?)₁₀.
Answer
Gray to binary: copy the MSB; each next binary bit = previous binary bit ⊕ current Gray bit.
→
Answer:
- 2080 Bhadra · 1.5 marks
Convert (1001 1010)excess-3 = (?)BCD.
Answer
Subtract 3 (0011) from each group to get the decimal digit, then write it in BCD.
| XS-3 group | − 3 | Digit | BCD |
|---|---|---|---|
| 1001 (9) | 6 | 6 | 0110 |
| 1010 (10) | 7 | 7 | 0111 |
Answer:
- 2080 Baisakh · 1+2 marks
What is importance of coding? Explain about ASCII code briefly.
Answer
Importance of coding
Digital systems understand only 0s and 1s, so numbers, letters and symbols must be coded into binary patterns. Coding allows data to be stored, processed and exchanged in a standard way, makes displays easy (BCD), reduces errors (Gray code, parity, Hamming code) and allows secure or compressed transmission.
ASCII code
ASCII (American Standard Code for Information Interchange) is a 7-bit alphanumeric code representing characters:
- 0–31 and 127: control characters (e.g. CR = 13, LF = 10).
- 48–57: digits '0'–'9'; 65–90: 'A'–'Z'; 97–122: 'a'–'z'.
Examples: 'A' = 65 = 100 0001 (41H); 'a' = 97 = 110 0001 (61H); '5' = 53 = 011 0101. An 8th bit is often used for parity or extended ASCII.
- 2080 Baisakh · 1.5 marks
Convert (101101.011)₂ = (?)₁₀.
Answer
Answer:
- 2080 Baisakh · 1.5 marks
Convert (110111)gray = (?)₂.
Answer
Copy the MSB; each next binary bit = previous binary bit ⊕ current Gray bit.
| Gray bit | 1 | 1 | 0 | 1 | 1 | 1 |
|---|---|---|---|---|---|---|
| Operation | copy | 1⊕1 | 0⊕0 | 0⊕1 | 1⊕1 | 0⊕1 |
| Binary bit | 1 | 0 | 0 | 1 | 0 | 1 |
Answer: (= 37 in decimal)
- 2080 Baisakh · 1.5 marks
Convert (524)₈ = (?)₁₆.
Answer
Convert octal to binary (3 bits per digit), then regroup in 4 bits from the right.
5 = 101, 2 = 010, 4 = 100 →
Regroup: → 1 5 4
Check: , and .
Answer:
- 2080 Baisakh · 1.5 marks
Convert (125.25)₁₀ = (?)₂.
Answer
Integer: 125 → 62 r1, 31 r0, 15 r1, 7 r1, 3 r1, 1 r1, 0 r1 → read upwards: .
Fraction: 0.25 × 2 = 0.5 → 0; 0.5 × 2 = 1.0 → 1 → .
Check: .
Answer:
- 2079 Bhadra · 2+4 marks
Write down the advantages of digital systems. Define BCD and excess-3 codes.
Answer
Advantages of digital systems
- Noise immunity: small noise does not change 0 into 1, so results are reliable.
- Easy storage: data is stored in memories without loss and copied exactly.
- Accuracy and precision depend only on the number of bits, not on component drift.
- Programmability: operation can be changed by software.
- Error detection and correction using parity and codes.
- Easy design and high integration: millions of gates on one IC give low cost, small size and low power.
- Regeneration: signals can be restored by repeaters during transmission.
BCD code
BCD (8421) code represents each decimal digit 0–9 separately by its 4-bit binary value. Codes 1010–1111 are invalid. Example: = 0101 1001 (BCD).
Excess-3 code
Excess-3 (XS-3) is an unweighted BCD code in which each decimal digit is coded as the binary of (digit + 3). It is self-complementing: inverting the bits gives the 9's complement. Example: : 5 + 3 = 8 → 1000, 9 + 3 = 12 → 1100 → .
| Decimal | 0 | 3 | 5 | 9 |
|---|---|---|---|---|
| BCD | 0000 | 0011 | 0101 | 1001 |
| XS-3 | 0011 | 0110 | 1000 | 1100 |
- 2079 Bhadra · 1.5 marks
Convert (329.54)₁₀ = (?)₁₆.
Answer
Integer part: 329 ÷ 16 = 20 r 9; 20 ÷ 16 = 1 r 4; 1 ÷ 16 = 0 r 1 → .
Fraction part (multiply by 16):
| Step | Result | Digit |
|---|---|---|
| 0.54 × 16 | 8.64 | 8 |
| 0.64 × 16 | 10.24 | A |
| 0.24 × 16 | 3.84 | 3 |
| 0.84 × 16 | 13.44 | D |
| 0.44 × 16 | 7.04 | 7 |
The fraction does not terminate, so we stop at 5 digits.
Answer:
- 2079 Bhadra · 1.5 marks
Convert (BD.1A)₁₆ = (?)₁₀.
Answer
Answer:
- 2079 Bhadra · 1.5 marks
Convert (01010111)gray = (?)₂.
Answer
Rule (Gray to binary): the MSB of binary equals the MSB of Gray. Each next binary bit = previous binary bit XOR current Gray bit, .
| Gray bit | Operation | Binary bit |
|---|---|---|
| 0 | copy MSB | 0 |
| 1 | 1 | |
| 0 | 1 | |
| 1 | 0 | |
| 0 | 0 | |
| 1 | 1 | |
| 1 | 0 | |
| 1 | 1 |
Check: converting 01100101 back to Gray () gives 01010111 again.
Answer: (= ).
- 2079 Bhadra · 1.5 marks
Convert (1010 0111)excess-3 = (?)BCD.
Answer
Rule: an excess-3 (XS-3) code word is the BCD code of each decimal digit plus 3 (0011). So subtract 0011 from each 4-bit group to get the BCD digit.
| XS-3 group | Value | Subtract 3 | BCD |
|---|---|---|---|
| 1010 | 10 | 10 − 3 = 7 | 0111 |
| 0111 | 7 | 7 − 3 = 4 | 0100 |
So the decimal number is 74.
Answer: (= ).
- 2078 Bhadra · 2+2 marks
Define analog and digital signal. What are the advantages of digital system over analog system?
Answer
Analog and digital signal
- Analog signal: a signal that varies continuously with time and can take any value within a range. Example: the voltage from a microphone, output of a thermocouple, a sine wave .
- Digital signal: a signal that takes only a finite number of discrete values, usually two levels (HIGH = 1, LOW = 0), and changes in steps. Example: the clock pulse in a computer, the output of a TTL gate (0 V / +5 V).
Analog Digital
.-. .-. __ __ __
/ \ / \ | | | | | |
/ \ / \ ___| |__| |__| |__
' t ->
Advantages of digital systems over analog systems
- Noise immunity: only two levels need to be told apart, so small noise does not change the information.
- Accuracy and precision: accuracy can be increased simply by using more bits; analog accuracy is limited by component tolerance.
- Easy storage: digital data can be stored for a long time in memories (RAM, ROM, flash, disks) without degradation.
- Programmability: the operation of a digital system can be changed by software (e.g. microprocessors).
- Easy design: design uses switching (Boolean) algebra; exact voltage values are not important.
- Integration: many gates can be placed on one IC chip, so systems are small, cheap and reliable.
- Easy processing and transmission: data can be encrypted, compressed, error-checked and copied without loss.
- Less effect of temperature and ageing on circuit behaviour.
- 2078 Kartik · 1.5+1.5 marks
Explain ASCII and EBCDIC codes with example.
Answer
Both are alphanumeric codes: binary codes that represent letters, digits, punctuation marks and control characters so that text can be stored and sent by digital systems.
ASCII
- American Standard Code for Information Interchange.
- A 7-bit code, so it has characters (0–127); often stored in 8 bits with the MSB as 0 or as a parity bit.
- Codes 0–31 and 127 are control characters (e.g. LF = 0AH, CR = 0DH); 32–126 are printable.
- Letters and digits are in order, which makes sorting easy.
- Examples: 'A' = 100 0001 (41H), 'a' = 110 0001 (61H), '0' = 011 0000 (30H), space = 20H.
- Used in PCs, keyboards, the internet and most modern systems.
EBCDIC
- Extended Binary Coded Decimal Interchange Code, developed by IBM.
- An 8-bit code, so up to characters.
- Based on BCD: the lower 4 bits of a digit are its BCD value and the upper 4 bits (zone) are 1111.
- Letters are not in one continuous block (gaps between I/J and R/S).
- Examples: 'A' = 1100 0001 (C1H), 'a' = 1000 0001 (81H), '0' = 1111 0000 (F0H), '9' = F9H.
- Used mainly in IBM mainframes.
| Character | ASCII (hex) | EBCDIC (hex) |
|---|---|---|
| A | 41 | C1 |
| a | 61 | 81 |
| 0 | 30 | F0 |
- 2078 Kartik · 2 marks
Convert (5A.B)₁₆ = (?)Excess-3.
Answer
Excess-3 code is defined for decimal digits, so first convert the hexadecimal number to decimal, then add 3 (0011) to the BCD code of each decimal digit.
Step 1: Hex to decimal
Step 2: Each digit + 3, written in 4 bits
| Digit | 9 | 0 | . | 6 | 8 | 7 | 5 |
|---|---|---|---|---|---|---|---|
| Digit + 3 | 12 | 3 | . | 9 | 11 | 10 | 8 |
| XS-3 | 1100 | 0011 | . | 1001 | 1011 | 1010 | 1000 |
Answer:
- 2078 Kartik · 2 marks
Convert (1011011)₂ = (?)BCD.
Answer
BCD codes each decimal digit separately in 4 bits, so first convert the binary number to decimal.
Step 1: Binary to decimal
Step 2: Each decimal digit to 4-bit BCD
| Decimal digit | 9 | 1 |
|---|---|---|
| BCD | 1001 | 0001 |
Answer:
- 2076 Chaitra · 3 marks
Write the basic difference between analog and digital signals with examples.
Answer
An analog signal is continuous in time and amplitude and can take any value in a range; a digital signal has only discrete levels (usually 0 and 1) and changes in steps.
| Point | Analog signal | Digital signal |
|---|---|---|
| Nature | Continuous, smooth | Discrete, step-wise (0/1) |
| Values | Infinite values in a range | Finite values (two in binary) |
| Waveform | Sine-like curves | Square / rectangular pulses |
| Noise | Easily affected; noise adds to signal | High noise immunity |
| Storage | Hard to store without loss | Easy to store in memory |
| Accuracy | Limited by component tolerance | Set by number of bits |
| Processing | Analog circuits (op-amps, filters) | Logic gates, processors |
| Examples | Microphone output, thermocouple voltage, room temperature, AM radio | Computer data, clock pulses, TTL output, CD audio |
Analog: ~~~~ continuous curve ~~~~
Digital: _|‾‾|__|‾‾‾‾|_|‾|__
- 2076 Chaitra · 1.5 marks
Convert (430.25)₈ = (?)₁₆.
Answer
Convert octal to binary (3 bits per digit), then regroup the bits in 4s from the binary point (pad with 0s at the ends) to get hex.
Step 1: Octal to binary
| Octal | 4 | 3 | 0 | . | 2 | 5 |
|---|---|---|---|---|---|---|
| Binary | 100 | 011 | 000 | . | 010 | 101 |
Step 2: Group in 4 bits
| Groups | 0001 | 0001 | 1000 | . | 0101 | 0100 |
|---|---|---|---|---|---|---|
| Hex | 1 | 1 | 8 | . | 5 | 4 |
Check: and .
Answer:
- 2076 Chaitra · 1.5 marks
Convert (39.75)₁₀ = (?)₈.
Answer
Convert the integer part by repeated division by 8 and the fraction part by repeated multiplication by 8.
Integer part (39):
| Division | Quotient | Remainder |
|---|---|---|
| 39 ÷ 8 | 4 | 7 |
| 4 ÷ 8 | 0 | 4 |
Reading remainders bottom to top: .
Fraction part (0.75):
| Multiplication | Result | Integer digit |
|---|---|---|
| 0.75 × 8 | 6.00 | 6 |
Fraction becomes 0, so .
Check: .
Answer:
- 2076 Chaitra · 1.5 marks
Convert (17)₁₀ = (?)gray.
Answer
First convert decimal to binary, then to Gray code: the MSB stays the same and each next Gray bit is the XOR of two adjacent binary bits, .
Step 1:
Step 2: Binary to Gray
| Binary bits | Operation | Gray bit |
|---|---|---|
| 1 | copy MSB | 1 |
| 1, 0 | 1 | |
| 0, 0 | 0 | |
| 0, 0 | 0 | |
| 0, 1 | 1 |
Answer:
- 2076 Chaitra · 1.5 marks
Convert (17)excess-3 = (?)BCD.
Answer
"17" is not a valid excess-3 bit pattern (XS-3 is written in 4-bit binary groups), so the question is read as: write decimal 17 in excess-3 code and in BCD.
BCD: each decimal digit in 4-bit binary.
| Digit | 1 | 7 |
|---|---|---|
| BCD | 0001 | 0111 |
Excess-3: each decimal digit + 3, in 4-bit binary.
| Digit | 1 | 7 |
|---|---|---|
| Digit + 3 | 4 | 10 |
| XS-3 | 0100 | 1010 |
Going from XS-3 back to BCD means subtracting 0011 from each group: , .
Answer:
- 2076 Chaitra · 2+5 marks
Define excess-3 code with example. Design a binary to excess-3 code converter circuit using basic gates.
Answer
Excess-3 code
Excess-3 (XS-3) is an unweighted BCD-type code in which each decimal digit is represented by the 4-bit binary of (digit + 3). For example, 5 → 5 + 3 = 8 → 1000, and . It is self-complementing: the 9's complement of a digit is got by inverting its bits (e.g. 2 = 0101, 7 = 1010), which makes decimal subtraction easy.
Binary (BCD) to excess-3 converter
Assumption: input is a 4-bit binary number ABCD (A = MSB) with values 0–9; inputs 10–15 never occur and are taken as don't cares. Outputs are WXYZ = input + 3.
Truth table
| Dec | A B C D | W X Y Z |
|---|---|---|
| 0 | 0 0 0 0 | 0 0 1 1 |
| 1 | 0 0 0 1 | 0 1 0 0 |
| 2 | 0 0 1 0 | 0 1 0 1 |
| 3 | 0 0 1 1 | 0 1 1 0 |
| 4 | 0 1 0 0 | 0 1 1 1 |
| 5 | 0 1 0 1 | 1 0 0 0 |
| 6 | 0 1 1 0 | 1 0 0 1 |
| 7 | 0 1 1 1 | 1 0 1 0 |
| 8 | 1 0 0 0 | 1 0 1 1 |
| 9 | 1 0 0 1 | 1 1 0 0 |
| 10–15 | – | x x x x |
Output functions
K-map for W (rows AB, columns CD in order 00, 01, 11, 10):
CD=00 01 11 10
AB=00 0 0 0 0
AB=01 0 1 1 1
AB=11 x x x x
AB=10 1 1 x x
Groups: A (bottom two rows, octet), BD and BC (quads) → .
Simplifying the other maps the same way:
Logic diagram (basic gates)
C --+--[OR]-- (C+D) --+---[AND]-- B(C+D) --+
D --+ | B --+ |--[OR]-- W
| |
| A ------------+
|
(C+D) --[AND]-- B'(C+D) --+
B' --+ |--[OR]-- X
(C+D)'--[AND]-- B(C+D)' --+
B --+
C --[AND]-- CD ---+
D --+ |--[OR]-- Y
C'--[AND]-- C'D'--+
D'--+
D --[NOT]---------------- Z
The circuit uses NOT gates for B', C', D' and (C+D)', plus AND and OR gates as shown. Check: for input 0110 (6), W = 0 + 1·1 = 1, X = 0, Y = 0, Z = 1 → 1001 = 9 = 6 + 3.
- 2076 Asoj
Define Gray Code and convert (11101)Gray code to binary. When (FF)H is ANDed with (CA)H what will be the resulting number.
Answer
Gray code
Gray code is an unweighted, cyclic (reflected binary) code in which two successive numbers differ in only one bit. Example: 0 → 000, 1 → 001, 2 → 011, 3 → 010, 4 → 110. Because only one bit changes at a time, it avoids false outputs during transitions and is used in shaft encoders and K-map labelling.
(11101) Gray to binary
Rule: , then .
| Gray bit | Operation | Binary bit |
|---|---|---|
| 1 | copy | 1 |
| 1 | 0 | |
| 1 | 1 | |
| 0 | 1 | |
| 1 | 0 |
Answer:
(FF)H AND (CA)H
AND is done bit by bit:
FFH = 1111 1111
CAH = 1100 1010
AND = 1100 1010
ANDing any bit with 1 leaves it unchanged, so FFH acts as a mask that passes the other number.
Answer:
- 2075 Chaitra · 4 marks
Write down the advantages and disadvantages of digital signals over analog signals.
Answer
A digital signal has only discrete levels (0 and 1), while an analog signal varies continuously. Using digital signals has these advantages and disadvantages.
Advantages
- High noise immunity: only HIGH and LOW must be recognised, so small noise does not corrupt the data.
- Better accuracy: precision can be raised by adding more bits.
- Easy storage: data can be kept in memories (RAM, ROM, flash) for long periods without loss.
- Programmable: behaviour can be changed by software, e.g. microprocessors.
- Easy design and testing using Boolean algebra; exact voltage values do not matter.
- High integration: many gates fit on one IC, giving small size, low cost and high reliability.
- Error detection and correction, encryption and compression are easy.
- Copies are exact, and signals can be regenerated during long-distance transmission.
Disadvantages
- Real world is analog: temperature, sound, pressure, etc. are analog, so ADCs and DACs are needed, which add cost, delay and complexity.
- Quantisation error: converting to digital loses some information.
- More bandwidth: a digital signal needs more bandwidth than the analog signal it carries.
- Processing time: conversion and processing take time, which can limit very high-frequency work.
- Power and synchronisation: fast digital circuits need clocks, timing control and can use more power.
| Feature | Digital | Analog |
|---|---|---|
| Noise effect | Low | High |
| Storage | Easy | Difficult |
| Bandwidth need | More | Less |
| Interfacing to real world | Needs ADC/DAC | Direct |
- 2075 Chaitra · 1.5 marks
Convert (53.125)₁₀ = (?)₂.
Answer
Convert the integer part by repeated division by 2 and the fraction part by repeated multiplication by 2.
Integer part (53):
| Division | Quotient | Remainder |
|---|---|---|
| 53 ÷ 2 | 26 | 1 |
| 26 ÷ 2 | 13 | 0 |
| 13 ÷ 2 | 6 | 1 |
| 6 ÷ 2 | 3 | 0 |
| 3 ÷ 2 | 1 | 1 |
| 1 ÷ 2 | 0 | 1 |
Bottom to top: .
Fraction part (0.125):
| Multiplication | Result | Bit |
|---|---|---|
| 0.125 × 2 | 0.25 | 0 |
| 0.25 × 2 | 0.5 | 0 |
| 0.5 × 2 | 1.0 | 1 |
Top to bottom: .
Answer:
- 2075 Chaitra · 1.5 marks
Convert (615)₈ = (?)BCD.
Answer
BCD codes decimal digits, so first convert octal to decimal.
Step 1: Octal to decimal
Step 2: Each decimal digit in 4 bits
| Digit | 3 | 9 | 7 |
|---|---|---|---|
| BCD | 0011 | 1001 | 0111 |
Answer:
- 2075 Chaitra · 1.5 marks
Convert (10011)Gray = (?)₈.
Answer
Convert Gray to binary, then group the binary in 3 bits for octal.
Step 1: Gray to binary (, )
| Gray bit | Operation | Binary bit |
|---|---|---|
| 1 | copy | 1 |
| 0 | 1 | |
| 0 | 1 | |
| 1 | 0 | |
| 1 | 1 |
Step 2: Binary to octal (group from the right: 011 101)
| Group | 011 | 101 |
|---|---|---|
| Octal | 3 | 5 |
Check: .
Answer:
- 2075 Chaitra · 1.5 marks
Convert (11001001)excess-3 = (?)₈.
Answer
Decode the excess-3 groups to decimal (subtract 3 from each group), then convert decimal to octal.
Step 1: XS-3 to decimal
| XS-3 group | 1100 | 1001 |
|---|---|---|
| Value | 12 | 9 |
| Minus 3 | 9 | 6 |
So the number is .
Step 2: Decimal to octal
| Division | Quotient | Remainder |
|---|---|---|
| 96 ÷ 8 | 12 | 0 |
| 12 ÷ 8 | 1 | 4 |
| 1 ÷ 8 | 0 | 1 |
Bottom to top: 140. Check: .
Answer:
Questions from Old Question Collection (EX 502) (IOE EX 502 exam papers (BEL/BEX/BCT II/I) from 2068 to 2081) and Old Question Collection (BEI, EX 401) (IOE EX 401 exam papers (BEI I/I) from 2075 to 2082). Answers are written for this site; check them against your class notes.
Chapter titles and hours from the IOE syllabus ↗