Skip to main content

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

DecimalBCD (8421)Excess-3
000000011
100010100
200100101
300110110
401000111
501011000
601101001
701111010
810001011
910011100

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: (39)10(39)_{10}

  • 3 + 3 = 6 → 0110
  • 9 + 3 = 12 → 1100
  • (39)10=(0110 1100)XS−3(39)_{10} = (0110\ 1100)_{XS-3}

Example 2: (258)10(258)_{10}

  • 2 → 0101, 5 → 1000, 8 → 1011
  • (258)10=(0101 1000 1011)XS−3(258)_{10} = (0101\ 1000\ 1011)_{XS-3}

Properties

  1. Unweighted code: bit positions have no fixed weights.
  2. 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 9−4=59 - 4 = 5. This made subtraction simple in old machines.
  3. No all-zero code: every valid code has at least one 1, which helps detect a dead line.
  4. 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: 4+54 + 5

  • 0111+1000=11110111 + 1000 = 1111, no carry
  • subtract 0011: 1111−0011=11001111 - 0011 = 1100 = 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:

  1. 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.
  2. Regeneration: a digital signal can be fully restored by repeaters, so noise does not accumulate over long distances.
  3. Easy storage: data can be stored in memory, discs and flash without loss of quality, and copied any number of times exactly.
  4. Easy processing: digital data can be processed by computers and microprocessors using software.
  5. Error detection and correction: parity bits and codes (Hamming, CRC) can find and fix errors.
  6. Encryption and compression are easy to apply.
  7. Accuracy and precision are set by the number of bits, and do not drift with temperature or ageing.
  8. Design and integration: digital circuits are easy to design and fit in ICs with millions of gates, giving low cost and small size.
  9. 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

DecimalBinaryGrayDecimalBinaryGray
000000000810001100
100010001910011101
2001000111010101111
3001100101110111110
4010001101211001010
5010101111311011011
6011001011411101001
7011101001511111000

Binary to Gray

MSB stays the same; each next Gray bit = XOR of the current and previous binary bits: Gi=Bi+1⊕BiG_i = B_{i+1} \oplus B_i.

Example: (1011)2(1011)_2 → G = 1, 1⊕0 = 1, 0⊕1 = 1, 1⊕1 = 0 → (1110)Gray(1110)_{Gray}.

Gray to binary

MSB stays the same; each next binary bit = previous binary bit XOR current Gray bit: Bi=Bi+1⊕GiB_i = B_{i+1} \oplus G_i.

Example: (1110)Gray(1110)_{Gray} → B = 1, 1⊕1 = 0, 0⊕1 = 1, 1⊕0 = 1 → (1011)2(1011)_2.

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

DecimalBCDDecimalBCD
0000050101
1000160110
2001070111
3001181000
4010091001

The six combinations 1010 to 1111 are invalid in BCD.

Examples

  • (259)10(259)_{10} = 0010 0101 1001 (BCD)
  • (47)10(47)_{10} = 0100 0111 (BCD), whereas in pure binary 47=101111247 = 101111_2.
  • BCD 1001 0011 = (93)10(93)_{10}.

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: 7+57 + 5

    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 27=1282^7 = 128 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

CharacterDecimalHex7-bit ASCII
A6541100 0001
C6743100 0011
a9761110 0001
04830011 0000
Space3220010 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: (93)10(93)_{10} = 1001 0011 (BCD), while in binary 93=1011101293 = 1011101_2. BCD is used in calculators, clocks and 7-segment displays.

3-bit binary to Gray code converter

Inputs: binary B2B1B0B_2B_1B_0 (B2B_2 = MSB). Outputs: Gray G2G1G0G_2G_1G_0. In Gray code, successive values differ in only one bit.

Truth table (3-bit binary to Gray)

B2B_2B1B_1B0B_0G2G_2G1G_1G0G_0
000000
001001
010011
011010
100110
101111
110101
111100

Simplification (K-maps)

  • G2=∑m(4,5,6,7)=B2G_2 = \sum m(4,5,6,7) = B_2
  • G1=∑m(2,3,4,5)=Bˉ2B1+B2Bˉ1=B2⊕B1G_1 = \sum m(2,3,4,5) = \bar B_2 B_1 + B_2\bar B_1 = B_2 \oplus B_1
  • G0=∑m(1,2,5,6)=Bˉ1B0+B1Bˉ0=B1⊕B0G_0 = \sum m(1,2,5,6) = \bar B_1 B_0 + B_1\bar B_0 = B_1 \oplus B_0

K-map for G1G_1 (rows B2B_2, columns B1B0B_1B_0):

        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:

DivisionQuotientRemainder
39 ÷ 2191
19 ÷ 291
9 ÷ 241
4 ÷ 220
2 ÷ 210
1 ÷ 201

Reading upwards: (39)10=(100111)2(39)_{10} = (100111)_2.

Binary to Gray (keep MSB, then XOR adjacent bits):

 Binary : 1   0   0   1   1   1
          |  / \ / \ / \ / \ /
 Gray   : 1   1   0   1   0   0

G=1, 1⊕0=1, 0⊕0=0, 0⊕1=1, 1⊕1=0, 1⊕1=0G = 1,\ 1\oplus0=1,\ 0\oplus0=0,\ 0\oplus1=1,\ 1\oplus1=0,\ 1\oplus1=0

Answer: (39)10=(110100)Gray(39)_{10} = (110100)_{Gray}

Decimal 39 to Excess-3

Add 3 to each digit: 3 + 3 = 6 → 0110; 9 + 3 = 12 → 1100.

Answer: (39)10=(0110 1100)XS−3(39)_{10} = (0110\ 1100)_{XS-3}

(−28) + (17) using 2's complement (8-bit)

  • +28=0001 1100+28 = 0001\ 1100
  • 1's complement: 1110 00111110\ 0011; add 1 → −28=1110 0100-28 = 1110\ 0100
  • +17=0001 0001+17 = 0001\ 0001
    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: 0000 1010+1=0000 1011=110000\ 1010 + 1 = 0000\ 1011 = 11.

Answer: (−28)+17=1111 01012=(−11)10(-28) + 17 = 1111\ 0101_2 = (-11)_{10}

  • 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: B2B1B0B_2B_1B_0 (binary, B2B_2 = MSB). Outputs: G2G1G0G_2G_1G_0.

Truth table (3-bit binary to Gray)

B2B_2B1B_1B0B_0G2G_2G1G_1G0G_0
000000
001001
010011
011010
100110
101111
110101
111100

Simplification (K-maps)

  • G2=∑m(4,5,6,7)=B2G_2 = \sum m(4,5,6,7) = B_2
  • G1=∑m(2,3,4,5)=Bˉ2B1+B2Bˉ1=B2⊕B1G_1 = \sum m(2,3,4,5) = \bar B_2 B_1 + B_2\bar B_1 = B_2 \oplus B_1
  • G0=∑m(1,2,5,6)=Bˉ1B0+B1Bˉ0=B1⊕B0G_0 = \sum m(1,2,5,6) = \bar B_1 B_0 + B_1\bar B_0 = B_1 \oplus B_0

K-map for G1G_1 (rows B2B_2, columns B1B0B_1B_0):

        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) (1110)Gray(1110)_{Gray} to BCD

Gray to binary: MSB is copied; each next binary bit = previous binary bit XOR current Gray bit.

StepGray bitBinary bit
MSB11
211 ⊕ 1 = 0
310 ⊕ 1 = 1
LSB01 ⊕ 0 = 1

(1110)Gray=(1011)2=(11)10(1110)_{Gray} = (1011)_2 = (11)_{10}. Each decimal digit in BCD: 1 → 0001, 1 → 0001.

Answer: (1110)Gray=(0001 0001)BCD(1110)_{Gray} = (0001\ 0001)_{BCD}

(ii) (1430)10(1430)_{10} to Excess-3

Add 3 to each digit and write in 4 bits:

Digit+3XS-3
140100
470111
360110
030011

Answer: (1430)10=(0100 0111 0110 0011)XS−3(1430)_{10} = (0100\ 0111\ 0110\ 0011)_{XS-3}

(iii) (−28) + 17 using 2's complement (8 bits)

  • +28=0001 1100+28 = 0001\ 1100
  • 1's complement =1110 0011= 1110\ 0011; add 1: −28=1110 0100-28 = 1110\ 0100
  • +17=0001 0001+17 = 0001\ 0001
    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 1111 01011111\ 0101 = 0000 1010+1=0000 1011=110000\ 1010 + 1 = 0000\ 1011 = 11.

Check: −28+17=−11-28 + 17 = -11.

Answer: 1111 01012=(−11)101111\ 0101_2 = (-11)_{10}

  • 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.

DecimalBinaryGray
0000000
1001001
2010011
3011010
4100110
5101111
6110101
7111100

Binary to Gray: keep MSB, then Gi=Bi+1⊕BiG_i = B_{i+1} \oplus B_i. Example: (1011)2(1011)_2 → 1, 1⊕0 = 1, 0⊕1 = 1, 1⊕1 = 0 → (1110)Gray(1110)_{Gray}. 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.

Decimal01259
XS-300110100010110001100

Example: (27)10(27)_{10} → 2+3 = 5 → 0101, 7+3 = 10 → 1010 → (0101 1010)XS−3(0101\ 1010)_{XS-3}. 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

PointBinary codeGray code
WeightsWeighted (1, 2, 4, 8…)Unweighted
Bit change between successive numbersOne or more (011 → 100 changes 3 bits)Exactly one
ArithmeticEasyNot suitable
Switching errorsPossible at transitionsMinimal
UsesComputation, storageEncoders, K-maps, ADCs

Convert (10110)2(10110)_2 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
  • G4=B4=1G_4 = B_4 = 1
  • G3=1⊕0=1G_3 = 1 \oplus 0 = 1
  • G2=0⊕1=1G_2 = 0 \oplus 1 = 1
  • G1=1⊕1=0G_1 = 1 \oplus 1 = 0
  • G0=1⊕0=1G_0 = 1 \oplus 0 = 1

Answer: (10110)2=(11101)Gray(10110)_2 = (11101)_{Gray}

  • 2078 Kartik · 2+2+2 marks

Perform the following code conversions: (i) (41.8125)₁₀ = (?)₂ (ii) (1000)₂ = (?)BCD (iii) (19)₁₀ = (?)Ex-3 code

Answer

(i) (41.8125)10(41.8125)_{10} to binary

Integer part (repeated division by 2):

DivisionQuotientRemainder
41 ÷ 2201
20 ÷ 2100
10 ÷ 250
5 ÷ 221
2 ÷ 210
1 ÷ 201

Reading upwards: 41=10100141 = 101001.

Fraction part (repeated multiplication by 2):

MultiplicationResultInteger bit
0.8125 × 21.6251
0.625 × 21.251
0.25 × 20.50
0.5 × 21.01

Reading downwards: 0.8125=.11010.8125 = .1101.

Answer: (41.8125)10=(101001.1101)2(41.8125)_{10} = (101001.1101)_2

(ii) (1000)2(1000)_2 to BCD

(1000)2=8(1000)_2 = 8, and the digit 8 in BCD is 1000.

Answer: (1000)2=(1000)BCD(1000)_2 = (1000)_{BCD} (for a two-digit view, 0000 1000)

(iii) (19)10(19)_{10} to Excess-3

Add 3 to each digit: 1 + 3 = 4 → 0100; 9 + 3 = 12 → 1100.

Answer: (19)10=(0100 1100)XS−3(19)_{10} = (0100\ 1100)_{XS-3}

  • 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: (57)10(57)_{10} = 0101 0111 (BCD).

Advantages

  1. Very easy conversion between decimal and BCD, as each digit is coded separately.
  2. Suitable for decimal displays (7-segment), calculators, digital clocks and meters, where numbers are shown to people.
  3. Decimal fractions such as 0.1 are represented exactly, so it is used in financial calculations.
  4. Easy to scale by powers of 10 (shift by one digit).

Disadvantages

  1. Needs more bits than pure binary: (99)10(99)_{10} needs 8 bits in BCD but only 7 in binary; storage is wasted.
  2. Six of the 16 4-bit combinations are unused.
  3. Arithmetic is more complex: after binary addition a correction (add 0110) is needed when a digit exceeds 9.
  4. 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.

DecimalBinaryGray
0000000
1001001
2010011
3011010
4100110
5101111
6110101
7111100

Comparison with binary numbers

PointBinaryGray
TypeWeighted (positional)Unweighted
Change between successive valuesMany bits may change (3 → 4: 011 → 100)Only one bit changes
ArithmeticEasy to add and subtractNot suitable for arithmetic
Error at transitionsFalse readings possibleVery small error
Conversion—Gi=Bi+1⊕BiG_i = B_{i+1} \oplus B_i

Example: (0111)2(0111)_2 → Gray (0100)(0100).

  • 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 signalDigital signal
Continuous in time and amplitudeDiscrete levels (usually 0 and 1)
Infinite possible values in a rangeFinite set of values
Example: sine wave, voiceExample: clock pulses, computer data
Easily affected by noiseHigh noise immunity
Hard to store without lossStored and copied exactly

Convert (A2.64)16(A2.64)_{16} to octal

Write each hex digit in 4 bits:

A=1010, 2=0010, 6=0110, 4=0100A = 1010,\ 2 = 0010,\ 6 = 0110,\ 4 = 0100

(A2.64)16=(1010 0010 . 0110 0100)2(A2.64)_{16} = (1010\ 0010\ .\ 0110\ 0100)_2

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: (A2.64)16=(242.31)8(A2.64)_{16} = (242.31)_8

Convert (A2.64)16(A2.64)_{16} to decimal

(A2.64)16=10×161+2×160+6×16−1+4×16−2=160+2+0.375+0.015625=162.390625\begin{aligned} (A2.64)_{16} &= 10\times16^1 + 2\times16^0 + 6\times16^{-1} + 4\times16^{-2} \\ &= 160 + 2 + 0.375 + 0.015625 \\ &= 162.390625 \end{aligned}

Check from octal: 2×64+4×8+2+3/8+1/64=162.3906252\times64 + 4\times8 + 2 + 3/8 + 1/64 = 162.390625.

Answer: (A2.64)16=(162.390625)10(A2.64)_{16} = (162.390625)_{10}

  • 2074 Chaitra · 3 marks

Convert 37.432 decimal number to binary.

Answer

Convert the integer and fraction parts separately.

Integer part: 37

DivisionQuotientRemainder
37 ÷ 2181
18 ÷ 290
9 ÷ 241
4 ÷ 220
2 ÷ 210
1 ÷ 201

Reading upwards: 37=10010137 = 100101.

Fraction part: 0.432

MultiplicationResultBit
0.432 × 20.8640
0.864 × 21.7281
0.728 × 21.4561
0.456 × 20.9120
0.912 × 21.8241
0.824 × 21.6481
0.648 × 21.2961
0.296 × 20.5920
0.592 × 21.1841
0.184 × 20.3680

The fraction does not terminate, so we stop after 10 bits. Reading downwards: 0.432≈.01101110100.432 \approx .0110111010.

Answer: (37.432)10≈(100101.0110111010)2(37.432)_{10} \approx (100101.0110111010)_2

Check: 100101.01101110102=37+442/1024=37.4316100101.0110111010_2 = 37 + 442/1024 = 37.4316, 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

DivisionQuotientRemainder
39 ÷ 2191
19 ÷ 291
9 ÷ 241
4 ÷ 220
2 ÷ 210
1 ÷ 201

Answer: (39)10=(100111)2(39)_{10} = (100111)_2

Decimal 39 to hexadecimal

39 ÷ 16 = 2 remainder 7, and 2 ÷ 16 = 0 remainder 2. (Check: group binary 0010 0111 → 2 7.)

Answer: (39)10=(27)16(39)_{10} = (27)_{16}

(−28) + 17 using 2's complement (8 bits)

  • +28=0001 1100+28 = 0001\ 1100
  • 1's complement: 1110 00111110\ 0011; add 1 → −28=1110 0100-28 = 1110\ 0100
  • +17=0001 0001+17 = 0001\ 0001
    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: 0000 1010+1=0000 1011=110000\ 1010 + 1 = 0000\ 1011 = 11.

Answer: 1111 01012=(−11)101111\ 0101_2 = (-11)_{10}

  • 2073 Shrawan · 3+2 marks

Perform the following code conversions: i) (1110)gray = (?)BCD ii) (1430)₁₀ = (?)Excess-3

Answer

(i) (1110)Gray(1110)_{Gray} to BCD

Step 1: Gray to binary. Copy the MSB; each next binary bit = previous binary bit ⊕ current Gray bit.

Gray bitOperationBinary bit
1 (MSB)copy1
11 ⊕ 10
10 ⊕ 11
01 ⊕ 01

(1110)Gray=(1011)2=8+2+1=(11)10(1110)_{Gray} = (1011)_2 = 8 + 2 + 1 = (11)_{10}

Step 2: decimal to BCD. Code each digit: 1 → 0001, 1 → 0001.

Answer: (1110)Gray=(0001 0001)BCD(1110)_{Gray} = (0001\ 0001)_{BCD}

(ii) (1430)10(1430)_{10} to Excess-3

Add 3 to each digit and write it in 4 bits:

DigitDigit + 3Excess-3
140100
470111
360110
030011

Answer: (1430)10=(0100 0111 0110 0011)XS−3(1430)_{10} = (0100\ 0111\ 0110\ 0011)_{XS-3}

  • 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: (10.0101)2=2+0.25+0.0625=2.3125(10.0101)_2 = 2 + 0.25 + 0.0625 = 2.3125, and (2.5)16=2+5/16=2.3125(2.5)_{16} = 2 + 5/16 = 2.3125.

Answer: (10.0101)2=(2.5)16(10.0101)_2 = (2.5)_{16}

  • 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: Gi=Bi+1⊕BiG_i = B_{i+1} \oplus B_i.

Binary pairXORGray bit
MSB 1copy1
1, 01 ⊕ 01
0, 10 ⊕ 11
1, 01 ⊕ 01
0, 00 ⊕ 00
0, 10 ⊕ 11
1, 01 ⊕ 01
0, 00 ⊕ 00
0, 10 ⊕ 11

Answer: (101001001)2=(111101101)Gray(101001001)_2 = (111101101)_{Gray}

  • 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).

DigitDigit + 3Excess-3
9121100
360110

Answer: (93)10=(1100 0110)XS−3(93)_{10} = (1100\ 0110)_{XS-3}

  • 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 nn bits is built by writing the (n−1)(n-1)-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
DecimalBinaryGray
0000000
1001001
2010011
3011010
4100110
5101111
6110101
7111100

Binary to Gray: keep the MSB; Gi=Bi+1⊕BiG_i = B_{i+1} \oplus B_i. Example: (1101)2(1101)_2 → 1, 1⊕1 = 0, 1⊕0 = 1, 0⊕1 = 1 → (1011)Gray(1011)_{Gray}.

Gray to binary: keep the MSB; Bi=Bi+1⊕GiB_i = B_{i+1} \oplus G_i. Example: (1011)Gray(1011)_{Gray} → 1, 1⊕0 = 1, 1⊕1 = 0, 0⊕1 = 1 → (1101)2(1101)_2.

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):

ParameterMeaningTTL value
VIL(max)V_{IL(max)}Highest input read as 00.8 V
VIH(min)V_{IH(min)}Lowest input read as 12.0 V
VOL(max)V_{OL(max)}Highest output for 00.4 V
VOH(min)V_{OH(min)}Lowest output for 12.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 = VOH(min)−VIH(min)=2.4−2.0=0.4V_{OH(min)} - V_{IH(min)} = 2.4 - 2.0 = 0.4 V (same for LOW: 0.8−0.4=0.40.8 - 0.4 = 0.4 V). For 5 V CMOS, typical levels are VIL=1.5V_{IL} = 1.5 V and VIH=3.5V_{IH} = 3.5 V.

Gray code

Gray code is an unweighted, reflected binary code in which successive numbers differ in only one bit.

DecimalBinaryGray
0000000
1001001
2010011
3011010
4100110
5101111
6110101
7111100

Binary to Gray: keep MSB, then Gi=Bi+1⊕BiG_i = B_{i+1} \oplus B_i. Example: (1001)2(1001)_2 → 1, 1⊕0 = 1, 0⊕0 = 0, 0⊕1 = 1 → (1101)Gray(1101)_{Gray}. 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.

(41A.2D)16=0100 0001 1010 . 0010 1101(41A.2D)_{16} = 0100\ 0001\ 1010\ .\ 0010\ 1101

 Integer : 010 000 011 010  -> 2 0 3 2
 Fraction: 001 011 010      -> 1 3 2

Answer: (41A.2D)16=(2032.132)8(41A.2D)_{16} = (2032.132)_8

  • 2082 Shrawan · 1 mark

Convert (37.85)₁₀ = (?)₈.

Answer

Integer part: 37 ÷ 8 = 4 r 5; 4 ÷ 8 = 0 r 4 → (45)8(45)_8.

Fraction part (multiply by 8):

StepResultDigit
0.85 × 86.86
0.8 × 86.46
0.4 × 83.23
0.2 × 81.61
0.6 × 84.84

The digits then repeat (6, 3, 1, 4, …).

Answer: (37.85)10≈(45.66314)8(37.85)_{10} \approx (45.66314)_8

  • 2082 Shrawan · 1 mark

Convert (19)₁₀ = (?)Gray.

Answer

First (19)10=(10011)2(19)_{10} = (10011)_2 (16 + 2 + 1). Then keep the MSB and XOR adjacent bits:

G=1, 1⊕0=1, 0⊕0=0, 0⊕1=1, 1⊕1=0G = 1,\ 1\oplus0 = 1,\ 0\oplus0 = 0,\ 0\oplus1 = 1,\ 1\oplus1 = 0

Answer: (19)10=(11010)Gray(19)_{10} = (11010)_{Gray}

  • 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− 3DigitBCD
1100 (12)991001
0011 (3)000000

Answer: (1100 0011)XS−3=(90)10=(1001 0000)BCD(1100\ 0011)_{XS-3} = (90)_{10} = (1001\ 0000)_{BCD}

  • 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 ABCDABCD (AA = MSB), valid 0–9. Outputs: Excess-3 code WXYZWXYZ = input + 3. Inputs 10–15 never occur, so they are don't cares (X).

DecABCDWXYZ
000000011
100010100
200100101
300110110
401000111
501011000
601101001
701111010
810001011
910011100

K-map simplification

Minterms (don't cares d=10d = 10–1515):

  • W=∑m(5,6,7,8,9)+dW = \sum m(5,6,7,8,9) + d
  • X=∑m(1,2,3,4,9)+dX = \sum m(1,2,3,4,9) + d
  • Y=∑m(0,3,4,7,8)+dY = \sum m(0,3,4,7,8) + d
  • Z=∑m(0,2,4,6,8)+dZ = \sum m(0,2,4,6,8) + d

K-map for WW (rows ABAB, columns CDCD):

          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: AA (rows 11 and 10), BDBD, BCBC.

Simplified expressions:

W=A+BC+BDX=BˉC+BˉD+BCˉDˉY=CD+CˉDˉZ=Dˉ\begin{aligned} W &= A + BC + BD \\ X &= \bar B C + \bar B D + B\bar C\bar D \\ Y &= CD + \bar C\bar D \\ Z &= \bar D \end{aligned}

(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 Bˉ\bar B, Cˉ\bar C, Dˉ\bar D. 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

PointBinary codeBCD code
MethodWhole number converted to base 2Each decimal digit coded separately in 4 bits
Example: 25110010010 0101
Bits neededFewer (efficient)More (e.g. 99 needs 8 bits vs 7)
Unused codesNone1010–1111 invalid
ArithmeticSimpleNeeds correction (add 0110)
Conversion to decimalLengthyVery easy
UseComputation, memoryDisplays, calculators, clocks
  • 2082 Baisakh · 3 marks

Convert Octal (623.77) to decimal, binary and hexadecimal.

Answer

To decimal

(623.77)8=6×82+2×8+3+7×8−1+7×8−2=384+16+3+0.875+0.109375=403.984375\begin{aligned} (623.77)_8 &= 6\times8^2 + 2\times8 + 3 + 7\times8^{-1} + 7\times8^{-2} \\ &= 384 + 16 + 3 + 0.875 + 0.109375 \\ &= 403.984375 \end{aligned}

Decimal: (403.984375)10(403.984375)_{10}

To binary

Replace each octal digit by 3 bits: 6 = 110, 2 = 010, 3 = 011, 7 = 111, 7 = 111.

Binary: (110010011.111111)2(110010011.111111)_2

To hexadecimal

Regroup the binary into 4 bits from the point:

 Integer : 0001 1001 0011  -> 1 9 3
 Fraction: 1111 1100       -> F C

Hexadecimal: (193.FC)16(193.FC)_{16} (check: 403+252/256=403.984375403 + 252/256 = 403.984375)

  • 2081 Bhadra · 6 marks

Convert the following number system: i) (21)₈ = (?)₂ ii) (671)₁₀ = (?)BCD iii) (110101.011)₂ = (?)₁₀

Answer

(i) (21)8(21)_8 to binary

Write each octal digit in 3 bits: 2 = 010, 1 = 001.

(21)8=(010 001)2(21)_8 = (010\ 001)_2 = (10001)2(10001)_2 (check: 2×8+1=17=16+12\times8 + 1 = 17 = 16 + 1).

(ii) (671)10(671)_{10} to BCD

Code each decimal digit in 4 bits:

Digit671
BCD011001110001

Answer: (671)10=(0110 0111 0001)BCD(671)_{10} = (0110\ 0111\ 0001)_{BCD}

(iii) (110101.011)2(110101.011)_2 to decimal

=1⋅25+1⋅24+0⋅23+1⋅22+0⋅21+1⋅20+0⋅2−1+1⋅2−2+1⋅2−3=32+16+4+1+0.25+0.125=53.375\begin{aligned} &= 1\cdot2^5 + 1\cdot2^4 + 0\cdot2^3 + 1\cdot2^2 + 0\cdot2^1 + 1\cdot2^0 + 0\cdot2^{-1} + 1\cdot2^{-2} + 1\cdot2^{-3} \\ &= 32 + 16 + 4 + 1 + 0.25 + 0.125 \\ &= 53.375 \end{aligned}

Answer: (110101.011)2=(53.375)10(110101.011)_2 = (53.375)_{10}

  • 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 signalDiscrete signal
Defined for all time ttDefined only at t=nTt = nT
Written x(t)x(t)Written x[n]x[n]
Example: voice, temperatureExample: daily rainfall, sampled audio
Processed by analog circuitsProcessed by digital systems

Convert (25.25)10(25.25)_{10} to binary

Integer: 25 → 25/2 = 12 r1, 12/2 = 6 r0, 6/2 = 3 r0, 3/2 = 1 r1, 1/2 = 0 r1 → 1100111001. Fraction: 0.25 × 2 = 0.5 → 0; 0.5 × 2 = 1.0 → 1 → .01.01.

Answer: (25.25)10=(11001.01)2(25.25)_{10} = (11001.01)_2

Convert (25.25)10(25.25)_{10} to octal

Integer: 25 ÷ 8 = 3 r 1; 3 ÷ 8 = 0 r 3 → 3131. Fraction: 0.25 × 8 = 2.0 → 2. (Check by grouping binary: 011 001 . 010 → 3 1 . 2.)

Answer: (25.25)10=(31.2)8(25.25)_{10} = (31.2)_8

  • 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: 1101011010.

Fraction: 0.75 × 2 = 1.5 → 1; 0.5 × 2 = 1.0 → 1 → .11.11.

Answer: (26.75)10=(11010.11)2(26.75)_{10} = (11010.11)_2

  • 2080 Bhadra · 1.5 marks

Convert (36.735)₈ = (?)₁₀.

Answer

(36.735)8=3×81+6×80+7×8−1+3×8−2+5×8−3=24+6+0.875+0.046875+0.009765625=30.931640625\begin{aligned} (36.735)_8 &= 3\times8^1 + 6\times8^0 + 7\times8^{-1} + 3\times8^{-2} + 5\times8^{-3} \\ &= 24 + 6 + 0.875 + 0.046875 + 0.009765625 \\ &= 30.931640625 \end{aligned}

Answer: (36.735)8=(30.931640625)10(36.735)_8 = (30.931640625)_{10}

  • 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.

B=1, 1⊕0=1, 1⊕1=0, 0⊕0=0, 0⊕1=1B = 1,\ 1\oplus0 = 1,\ 1\oplus1 = 0,\ 0\oplus0 = 0,\ 0\oplus1 = 1 → (11001)2(11001)_2

(11001)2=16+8+1=25(11001)_2 = 16 + 8 + 1 = 25

Answer: (10101)Gray=(25)10(10101)_{Gray} = (25)_{10}

  • 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− 3DigitBCD
1001 (9)660110
1010 (10)770111

Answer: (1001 1010)XS−3=(67)10=(0110 0111)BCD(1001\ 1010)_{XS-3} = (67)_{10} = (0110\ 0111)_{BCD}

  • 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 27=1282^7 = 128 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

(101101.011)2=25+23+22+20+2−2+2−3=32+8+4+1+0.25+0.125=45.375\begin{aligned} (101101.011)_2 &= 2^5 + 2^3 + 2^2 + 2^0 + 2^{-2} + 2^{-3} \\ &= 32 + 8 + 4 + 1 + 0.25 + 0.125 \\ &= 45.375 \end{aligned}

Answer: (101101.011)2=(45.375)10(101101.011)_2 = (45.375)_{10}

  • 2080 Baisakh · 1.5 marks

Convert (110111)gray = (?)₂.

Answer

Copy the MSB; each next binary bit = previous binary bit ⊕ current Gray bit.

Gray bit110111
Operationcopy1⊕10⊕00⊕11⊕10⊕1
Binary bit100101

Answer: (110111)Gray=(100101)2(110111)_{Gray} = (100101)_2 (= 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 → (101 010 100)2(101\ 010\ 100)_2

Regroup: 0001 0101 01000001\ 0101\ 0100 → 1 5 4

Check: (524)8=5×64+2×8+4=340(524)_8 = 5\times64 + 2\times8 + 4 = 340, and (154)16=256+80+4=340(154)_{16} = 256 + 80 + 4 = 340.

Answer: (524)8=(154)16(524)_8 = (154)_{16}

  • 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: 11111011111101.

Fraction: 0.25 × 2 = 0.5 → 0; 0.5 × 2 = 1.0 → 1 → .01.01.

Check: 64+32+16+8+4+1+0.25=125.2564 + 32 + 16 + 8 + 4 + 1 + 0.25 = 125.25.

Answer: (125.25)10=(1111101.01)2(125.25)_{10} = (1111101.01)_2

  • 2079 Bhadra · 2+4 marks

Write down the advantages of digital systems. Define BCD and excess-3 codes.

Answer

Advantages of digital systems

  1. Noise immunity: small noise does not change 0 into 1, so results are reliable.
  2. Easy storage: data is stored in memories without loss and copied exactly.
  3. Accuracy and precision depend only on the number of bits, not on component drift.
  4. Programmability: operation can be changed by software.
  5. Error detection and correction using parity and codes.
  6. Easy design and high integration: millions of gates on one IC give low cost, small size and low power.
  7. 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: (59)10(59)_{10} = 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: (59)10(59)_{10}: 5 + 3 = 8 → 1000, 9 + 3 = 12 → 1100 → (1000 1100)XS−3(1000\ 1100)_{XS-3}.

Decimal0359
BCD0000001101011001
XS-30011011010001100
  • 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 → (149)16(149)_{16}.

Fraction part (multiply by 16):

StepResultDigit
0.54 × 168.648
0.64 × 1610.24A
0.24 × 163.843
0.84 × 1613.44D
0.44 × 167.047

The fraction does not terminate, so we stop at 5 digits.

Answer: (329.54)10≈(149.8A3D7)16(329.54)_{10} \approx (149.8A3D7)_{16}

  • 2079 Bhadra · 1.5 marks

Convert (BD.1A)₁₆ = (?)₁₀.

Answer

(BD.1A)16=11×16+13×1+1×16−1+10×16−2=176+13+0.0625+0.0390625=189.1015625\begin{aligned} (BD.1A)_{16} &= 11\times16 + 13\times1 + 1\times16^{-1} + 10\times16^{-2} \\ &= 176 + 13 + 0.0625 + 0.0390625 \\ &= 189.1015625 \end{aligned}

Answer: (BD.1A)16=(189.1015625)10(BD.1A)_{16} = (189.1015625)_{10}

  • 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, Bi=Bi+1⊕GiB_i = B_{i+1} \oplus G_i.

Gray bit GiG_iOperationBinary bit BiB_i
0copy MSB0
10⊕10 \oplus 11
01⊕01 \oplus 01
11⊕11 \oplus 10
00⊕00 \oplus 00
10⊕10 \oplus 11
11⊕11 \oplus 10
10⊕10 \oplus 11

Check: converting 01100101 back to Gray (Gi=Bi+1⊕BiG_i = B_{i+1} \oplus B_i) gives 01010111 again.

Answer: (01010111)gray=(01100101)2(01010111)_{gray} = (01100101)_2 (= 10110101_{10}).

  • 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 groupValueSubtract 3BCD
10101010 − 3 = 70111
011177 − 3 = 40100

So the decimal number is 74.

Answer: (1010 0111)XS-3=(0111 0100)BCD(1010\ 0111)_{XS\text{-}3} = (0111\ 0100)_{BCD} (= 741074_{10}).

  • 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 v=Vmsin⁡ωtv = V_m \sin \omega t.
  • 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

  1. Noise immunity: only two levels need to be told apart, so small noise does not change the information.
  2. Accuracy and precision: accuracy can be increased simply by using more bits; analog accuracy is limited by component tolerance.
  3. Easy storage: digital data can be stored for a long time in memories (RAM, ROM, flash, disks) without degradation.
  4. Programmability: the operation of a digital system can be changed by software (e.g. microprocessors).
  5. Easy design: design uses switching (Boolean) algebra; exact voltage values are not important.
  6. Integration: many gates can be placed on one IC chip, so systems are small, cheap and reliable.
  7. Easy processing and transmission: data can be encrypted, compressed, error-checked and copied without loss.
  8. 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 27=1282^7 = 128 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 28=2562^8 = 256 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.
CharacterASCII (hex)EBCDIC (hex)
A41C1
a6181
030F0
  • 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

(5A.B)16=5×161+10×160+11×16−1=80+10+0.6875=(90.6875)10\begin{aligned} (5A.B)_{16} &= 5 \times 16^1 + 10 \times 16^0 + 11 \times 16^{-1} \\ &= 80 + 10 + 0.6875 \\ &= (90.6875)_{10} \end{aligned}

Step 2: Each digit + 3, written in 4 bits

Digit90.6875
Digit + 3123.911108
XS-311000011.1001101110101000

Answer: (5A.B)16=(90.6875)10=(1100 0011.1001 1011 1010 1000)XS-3(5A.B)_{16} = (90.6875)_{10} = (1100\ 0011.1001\ 1011\ 1010\ 1000)_{XS\text{-}3}

  • 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

(1011011)2=1⋅26+0⋅25+1⋅24+1⋅23+0⋅22+1⋅21+1⋅20=64+16+8+2+1=(91)10\begin{aligned} (1011011)_2 &= 1\cdot 2^6 + 0\cdot 2^5 + 1\cdot 2^4 + 1\cdot 2^3 + 0\cdot 2^2 + 1\cdot 2^1 + 1\cdot 2^0 \\ &= 64 + 16 + 8 + 2 + 1 \\ &= (91)_{10} \end{aligned}

Step 2: Each decimal digit to 4-bit BCD

Decimal digit91
BCD10010001

Answer: (1011011)2=(91)10=(1001 0001)BCD(1011011)_2 = (91)_{10} = (1001\ 0001)_{BCD}

  • 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.

PointAnalog signalDigital signal
NatureContinuous, smoothDiscrete, step-wise (0/1)
ValuesInfinite values in a rangeFinite values (two in binary)
WaveformSine-like curvesSquare / rectangular pulses
NoiseEasily affected; noise adds to signalHigh noise immunity
StorageHard to store without lossEasy to store in memory
AccuracyLimited by component toleranceSet by number of bits
ProcessingAnalog circuits (op-amps, filters)Logic gates, processors
ExamplesMicrophone output, thermocouple voltage, room temperature, AM radioComputer 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

Octal430.25
Binary100011000.010101

(430.25)8=(100011000.010101)2(430.25)_8 = (100011000.010101)_2

Step 2: Group in 4 bits

Groups000100011000.01010100
Hex118.54

Check: (430.25)8=280.32812510(430.25)_8 = 280.328125_{10} and (118.54)16=280+516+4256=280.328125(118.54)_{16} = 280 + \frac{5}{16} + \frac{4}{256} = 280.328125.

Answer: (430.25)8=(118.54)16(430.25)_8 = (118.54)_{16}

  • 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):

DivisionQuotientRemainder
39 ÷ 847
4 ÷ 804

Reading remainders bottom to top: 3910=47839_{10} = 47_8.

Fraction part (0.75):

MultiplicationResultInteger digit
0.75 × 86.006

Fraction becomes 0, so 0.7510=0.680.75_{10} = 0.6_8.

Check: 4×8+7+6/8=39.754 \times 8 + 7 + 6/8 = 39.75.

Answer: (39.75)10=(47.6)8(39.75)_{10} = (47.6)_8

  • 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, Gi=Bi+1⊕BiG_i = B_{i+1} \oplus B_i.

Step 1: 1710=16+1=(10001)217_{10} = 16 + 1 = (10001)_2

Step 2: Binary to Gray

Binary bitsOperationGray bit
1copy MSB1
1, 01⊕01 \oplus 01
0, 00⊕00 \oplus 00
0, 00⊕00 \oplus 00
0, 10⊕10 \oplus 11

Answer: (17)10=(10001)2=(11001)gray(17)_{10} = (10001)_2 = (11001)_{gray}

  • 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.

Digit17
BCD00010111

Excess-3: each decimal digit + 3, in 4-bit binary.

Digit17
Digit + 3410
XS-301001010

Going from XS-3 back to BCD means subtracting 0011 from each group: 0100−0011=00010100 - 0011 = 0001, 1010−0011=01111010 - 0011 = 0111.

Answer: (17)10=(0100 1010)XS-3=(0001 0111)BCD(17)_{10} = (0100\ 1010)_{XS\text{-}3} = (0001\ 0111)_{BCD}

  • 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 (27)10=0101 1010(27)_{10} = 0101\ 1010. 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

DecA B C DW X Y Z
00 0 0 00 0 1 1
10 0 0 10 1 0 0
20 0 1 00 1 0 1
30 0 1 10 1 1 0
40 1 0 00 1 1 1
50 1 0 11 0 0 0
60 1 1 01 0 0 1
70 1 1 11 0 1 0
81 0 0 01 0 1 1
91 0 0 11 1 0 0
10–15–x x x x

Output functions

  • W=Σm(5,6,7,8,9)+d(10–15)W = \Sigma m(5,6,7,8,9) + d(10\text{–}15)
  • X=Σm(1,2,3,4,9)+d(10–15)X = \Sigma m(1,2,3,4,9) + d(10\text{–}15)
  • Y=Σm(0,3,4,7,8)+d(10–15)Y = \Sigma m(0,3,4,7,8) + d(10\text{–}15)
  • Z=Σm(0,2,4,6,8)+d(10–15)Z = \Sigma m(0,2,4,6,8) + d(10\text{–}15)

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) → W=A+BC+BDW = A + BC + BD.

Simplifying the other maps the same way:

W=A+BC+BD=A+B(C+D)X=B′C+B′D+BC′D′=B′(C+D)+B(C+D)′Y=CD+C′D′=(C⊕D)′Z=D′\begin{aligned} W &= A + BC + BD = A + B(C + D) \\ X &= B'C + B'D + BC'D' = B'(C+D) + B(C+D)' \\ Y &= CD + C'D' = (C \oplus D)' \\ Z &= D' \end{aligned}

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: BMSB=GMSBB_{MSB} = G_{MSB}, then Bi=Bi+1⊕GiB_i = B_{i+1} \oplus G_i.

Gray bitOperationBinary bit
1copy1
11⊕11 \oplus 10
10⊕10 \oplus 11
01⊕01 \oplus 01
11⊕11 \oplus 10

Answer: (11101)Gray=(10110)2=2210(11101)_{Gray} = (10110)_2 = 22_{10}

(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: (FF)H⋅(CA)H=(CA)H=(11001010)2=20210(FF)_H \cdot (CA)_H = (CA)_H = (11001010)_2 = 202_{10}

  • 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

  1. High noise immunity: only HIGH and LOW must be recognised, so small noise does not corrupt the data.
  2. Better accuracy: precision can be raised by adding more bits.
  3. Easy storage: data can be kept in memories (RAM, ROM, flash) for long periods without loss.
  4. Programmable: behaviour can be changed by software, e.g. microprocessors.
  5. Easy design and testing using Boolean algebra; exact voltage values do not matter.
  6. High integration: many gates fit on one IC, giving small size, low cost and high reliability.
  7. Error detection and correction, encryption and compression are easy.
  8. Copies are exact, and signals can be regenerated during long-distance transmission.

Disadvantages

  1. Real world is analog: temperature, sound, pressure, etc. are analog, so ADCs and DACs are needed, which add cost, delay and complexity.
  2. Quantisation error: converting to digital loses some information.
  3. More bandwidth: a digital signal needs more bandwidth than the analog signal it carries.
  4. Processing time: conversion and processing take time, which can limit very high-frequency work.
  5. Power and synchronisation: fast digital circuits need clocks, timing control and can use more power.
FeatureDigitalAnalog
Noise effectLowHigh
StorageEasyDifficult
Bandwidth needMoreLess
Interfacing to real worldNeeds ADC/DACDirect
  • 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):

DivisionQuotientRemainder
53 ÷ 2261
26 ÷ 2130
13 ÷ 261
6 ÷ 230
3 ÷ 211
1 ÷ 201

Bottom to top: 5310=110101253_{10} = 110101_2.

Fraction part (0.125):

MultiplicationResultBit
0.125 × 20.250
0.25 × 20.50
0.5 × 21.01

Top to bottom: 0.12510=0.00120.125_{10} = 0.001_2.

Answer: (53.125)10=(110101.001)2(53.125)_{10} = (110101.001)_2

  • 2075 Chaitra · 1.5 marks

Convert (615)₈ = (?)BCD.

Answer

BCD codes decimal digits, so first convert octal to decimal.

Step 1: Octal to decimal

(615)8=6×82+1×81+5×80=384+8+5=(397)10\begin{aligned} (615)_8 &= 6 \times 8^2 + 1 \times 8^1 + 5 \times 8^0 \\ &= 384 + 8 + 5 \\ &= (397)_{10} \end{aligned}

Step 2: Each decimal digit in 4 bits

Digit397
BCD001110010111

Answer: (615)8=(397)10=(0011 1001 0111)BCD(615)_8 = (397)_{10} = (0011\ 1001\ 0111)_{BCD}

  • 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 (BMSB=GMSBB_{MSB} = G_{MSB}, Bi=Bi+1⊕GiB_i = B_{i+1} \oplus G_i)

Gray bitOperationBinary bit
1copy1
01⊕01 \oplus 01
01⊕01 \oplus 01
11⊕11 \oplus 10
10⊕10 \oplus 11

(10011)Gray=(11101)2=2910(10011)_{Gray} = (11101)_2 = 29_{10}

Step 2: Binary to octal (group from the right: 011 101)

Group011101
Octal35

Check: 3×8+5=293 \times 8 + 5 = 29.

Answer: (10011)Gray=(35)8(10011)_{Gray} = (35)_8

  • 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 group11001001
Value129
Minus 396

So the number is 961096_{10}.

Step 2: Decimal to octal

DivisionQuotientRemainder
96 ÷ 8120
12 ÷ 814
1 ÷ 801

Bottom to top: 140. Check: 1×64+4×8+0=961 \times 64 + 4 \times 8 + 0 = 96.

Answer: (11001001)XS-3=(96)10=(140)8(11001001)_{XS\text{-}3} = (96)_{10} = (140)_8

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 ↗