Download as pdf or txt
Download as pdf or txt
You are on page 1of 26

1

Number System and Binary Arithmetic

1.1 Number Systems :


• A Decimal number system said to be base 10 because. It uses 10 digits (0 to 9)
• A binary number system has base 2 because it uses 2 digits (0 & 1)
• Any number to the base ‘r’ uses r digits from 0 to (r – 1). If the value of base r  10 , r digits are taken
from decimal number system if the value of base r > 10 the latters of alphabats are used in addition to 10
decimal digits.
Example :
Hexadecimal system have base 16 and it requires 16 digits. Out of sixteen digits 10 digits are taken from
decimal number system while remaining 6 digits (10-15) are represented by latters (A to F) respectively.
i) Binary number system Base – 2
ii) Octal number system Base – 8
iii) Decimal number system Base – 10
iv) Hexadecimal number system Base – 16
1. Binary Number Systems
Digits used = 0, 1, Base or redix = 2
1.1.1 Binary Number System :
Binary number system consists of only two digits i.e. 0 and 1. In binary number system each digit is called a
bit, the group of four bits is called a nible and group of 8 bits is called a byte. The highest decimal number
represented by n digit numer is 2n – 1. For example with 4 bit binary number highest decimal number
represented is 24 – 1 = 15.
Decimal to binary conversion :- A decimal number can be converted into binary number dividing the
decimal number by two progressively until quotient zero is otained. Binary number is obtained by taking
remainder of each division in reverse order with first remainder as LSB and last remainder as MSB.
If decimal number is a fraction, its binary equivalent is obtained by multiplying the number progressively by 2
with carry generated as binary digit. First carry is taken as MSB and last carry as LSB.
Example-1 :
Conversion of 117 in to binary

www.digcademy.com digcademy@gmail.com
Number Systems DIGITAL ELECTRONICS 2

117
2 Quetient Remainder
2 58 1 LSB
2 29 0
2 14 1
2 7 0
2 3 1
2 1 1
0 1 MSB

(117)10 = (1110101)2
Example-2 :
Conversion of 0.61 into Binary
0.61 × 2 = 1.22 (MSB)1
× 
× 2 = 0.88 0
0.88 × 2 = 1.76 1
only upto 4 or 5 digits
 (0.61)10 = (0.1001)2
i) Binary to Decimal Conversion :
(.... X4 X3 X2 X1X0 . X–1 X–2 X–3 ...)
Decimal equation :
[(....X3r3 + X2 r2 + X1r1 + X0 r0) ·
( X–1r–1 + X–2 r– 2 + X–3r– 3 +....)]
For binary number system, r = 2
eg. (101101·001)2 = (X)10
(1 × 25 + 0 × 24 + 1 × 23 + 1 × 22 + 0 × 21 + 1 × 20) · (0 × 2–1 + 0 × 2–2 + 1× 2–3)
1
[1 + 0 + 4 + 8 + 0 + 32] ·   (45.125)10
8
1.1.2 Octal number System
This number system uses 0,1, 2, 3, 4, 5, 6 and 7 as digits. Its radix or base is 8.
i) Conversion from decimal to octal :
(a) Absolute (Integral value) : An absolute decimal number is converted into octal number by dividing the
number by 8 progressively as in binary system.
(b) Fractional number : A fractional number be converted to octal number by multiplying the number by
8 progressively as in case of binary system.
ii) Conversion from octal to Dacimal :
A number with radix or base ‘r’ can be converted to its decimal equivalent by multiplying each digit by its
respective weight and adding the products.
(467·32)8 = (X)10
For octal number system, r = 8
X = (7 × 80 + 6 × 81 + 4 × 82) · (3 × 8–1 + 2 × 8–2)
 2 
= (7  48  256)· 3/ 8  
 64 
= 311· (0.375 + 0.03125)
= (311· 406)10
1.1.3 Hexadecimal number System
Hexadecimal number system consists of 16 digits i.e. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E and F. The base
or radix of this number system is 16.

www.digcademy.com digcademy@gmail.com
Number Systems DIGITAL ELECTRONICS 3

Digits – 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
Base = 16
i) Conversion from Decimal to Hexadecimal
(a) Integral part : An absolute decimal number is converted to hexadecimal number by dividing
the number by 16 progressively in similar manner as in binary number system.
(b) Decimal part /Fractional part : A fractional decimal number is converted to hexadecimal number by
multiplying the number by 16 progressively in similar manner as in binary number system.
ii) Conversion from Hexadecimal to Decimal : A hexadecimal number can be converted to its decimal
equivalent by multiplying each digit by its respective weight and adding all the products.
Example :
(B7AF·3E)16 = (X)10
 3 14 
(15 × 163 + 10 × 162 + 7 × 161 + 11 × 160) ·   2 
 16 16 

 3 14 
(15 + 160 + 256 × 7 + 11 × 4096) ·  16  256 
 

 3 14 
= (15 + 160 + 1792 + 45056) ·   
 16 256 

3 14 
= 47023 ·   
 16 256 
 = (47023.242)10
1.2 Conversion of Number System
1. Binary to Hexadecimal :
Binary to Hexadecimal conversion is obtained by making group of four bits to left and right of decimal
point. Then each group is replaced by its hexadecimal equivalent number.
2. Hex to Binary :
Hexadecimal to binary conversion is obtained by replacing each digit by its binary equivalent of four bits.
 
e.g. (1A3.BA)16   00011010
  0011.10111010
 
 1 A 3 B A 2
  Binary to Octal Conversion : A binary number can be converted to its octal equivalent by making
group of three bits to left and right of decimal point. Then each group is replaced by its octal equivalent
number.
Example :
(101110010 · 0011)2 = (X)8

101110010 001 100


5 6 2 1 4
= (562.14)8
4. Octal to Binary Conversion : Octal to binary conversion is obtained by replacing each digit by its
binary equivalent of three bits.
(462.71)8 = (X)2
100 110 010.111001
(100110010.111001)2
5. Hexadecimal to octal conversion :
Hexadecimal to octal conversion is obtained by converting hexadecimal to binary and then from binary to
octal number.
6. Octal to Hexadecimal Conversion :

www.digcademy.com digcademy@gmail.com
Number Systems DIGITAL ELECTRONICS 4

Octal to hexadecimal conversion is obtained by converting octal to binary and then from binary to hexa-
decimal number.
“Table of Different Number System”

Decimal Binary Octal Hexadecimal


0 0000 00 0
1 0001 01 1
2 0010 02 2
3 0011 03 3
4 0100 04 4
5 0101 05 5
6 0110 06 6
7 0111 07 7
8 1000 10 8
9 1001 11 9
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F

1.3 Codes
Codes are symbolic representation of discrete information, which may be present in the form of number,
letters or physical quantities. These symbols are used to communicate information to computers.
1. Weighted binary codes
[8421, 7421, 5421, 5211, 4221, 3321, 2421, 342 1, 742 1 ]
2. Non-weighted codes [XS – 3, Gray code ]
3. Alpha-numeric codes – ASCII, EBCDIC, Hollerith code.
4. Error detecting code. Parity
5. Error Detecting and Correcting codes – Hamming.
Note: Maximum number of distinct quantities using n bits = 2n
Note : Each Digit of Decimal Number System is represented by a four digit code in weighted & non weighted
codes. Except Gray code.
1.3.1 Weighted codes
These are the codes in which each symbol position is assigned a weight.
In weight binary code each bit is multiplied by its weight indicated in code to get the decimal equivalent of the
code.
e.g. BCD (8421) , 7421, 5421, 5211, 4221 3321, 2421, 842 1, 742 1 .
Example :
Convert (8)10 in 7421, 5421, 5211, 4221, 3321, 2421 8421, 8421, 7421 codes
(a) (8)10 = 7 + 1 = (1001)7421
(b) (8)10 = 5 + 2 + 1 = (1011)5421
Note : Self compliment or reflective codes :
If ‘0’ is compliment of ‘9’, 1 is compliment of ‘8’, 2 is of 7, 3 is of 6, 4 is of 5, Then code is called self
compliment code.
Examples of self compliment codes – 5211, 4221, 3321, 2421, 842 1 ,
Note : Representation of (8)10 in 5211 code :
(8)10 = (1101)5211

www.digcademy.com digcademy@gmail.com
Number Systems DIGITAL ELECTRONICS 5

(1110)5211  (8)10 
 Both are correct .
(1101)5211  (8)10 
For self complementary ‘1’ Should be complement of code of ‘8’.
1.3.2 Non Weighted codes
Non-weighted codes are codes which are not positionally weighted, excess-3 code and gray codes are
example of non-weighted codes.
(i) Excess – 3 Code excess-3 code is obtained by adding 0011 to each BCD code of decimal numbers.
e.g :

decimal BCD Excess  3


0 0000 0011
1 0001 0100
2 0010 0101
: : :
9 1001 1100

Note : XS –3 code is self complimenting code or Reflective code


ii) Gray code :
In gray code every new code differs from the previous code only by a single bit. That is why it is also called
Reflected code. It can be used for measurement of shaft speed.
Note : It is also called unit distance code or minimum change code.
Binary to Gray Code conversion :
Binary code : B3 B2 B1 B0

  

Gray code : G3 G2 G1 G0

1.3.3 Alpha numeric codes


i) ASCII (American Standard code for Information Interchange)
It is a 7 bit code. It is most commonly used in microcomputers. This code represent a character with
seven bits, which can be stored as one byte with one bit used.
27 = 128 different patterns.
ii) ISCII (Indian standard code for Information Intercharge)
iii) EBCDIC (ebb. see-dic)
It uses eight bits for character and ninth bit for parity.
iv) Hollerith code (It is used in punch cards used for storage of information)
v) Morse code
It is used in Telegraph
vi) Tele type writter (TTY)
1.3.4 Error Detecting & correcting codes
i) Parity check code This code detects single bit error which changes parity of information. Errors with
more than one bit cannot be detected with this code.
ii) Hamming code  This code detects as well as corrects the error in an information. This code transmits
additional parity bits in addition to information bits. These parity bits are used to detect and correct the
error.
Error detecting code
1) Even Parity Method
2) Odd Parity Method
Even Parity Method

www.digcademy.com digcademy@gmail.com
Number Systems DIGITAL ELECTRONICS 6

In this method, the value of parity is added so that total member of 1´s in code group (including parity bit) is
even.
Parity = 0 or 1
Example :
odd (1011)  odd
(11000)  even
Odd Parity Method
In this method, the value of parity is added so that total number of 1´s in code group (including parity bit) is
odd.

Even Parity Odd Parity


A B C (P ) bit (Po)
e

0 0 0 0 1
0 0 1 1 0
0 1 0 1 0
0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 0

Even Parity
A

B XOR Pe
C

Odd Parity
A

B X-NOR Po
C

Note-1 The even parity bit generator and checker is the (XOR gate) odd parity bit generator and checker is
the (XNOR gate)
Note-2 Error correcting code Hamming code.
Note-3 For a code to be error correcting is minimum distance must be more than two.
1.4 Code Conversions
i) Decimal to BCD
Decimal to BCD conversion is obtained by replacing each digit of decimal number by its binary equiva-
lent
ii) Binary to BCD
Binary to BCD code conversion is possible by converting binary to decimal and then from decimal to its
BCD equivalent.
iii) BCD to Binary
BCD to binary conversion is obtained by converting the BCD to decimal and then decimal to its binary
equivalent.
iv) BCD to Excess - 3
BCD to excess-3 code conversion is obtained by adding 0011 to each BCD coded digit.
v) Excess – 3 to BCD :
Each (Excess – 3 code) – 0011 = BCD
Excess-3 to BCD code conversion is obtained by substracting 0011 from excess-3 code of each digit.
vi) Binary to Gray Code : Binary to gray code conversion is obtained by using rules as shown under.

www.digcademy.com digcademy@gmail.com
Number Systems DIGITAL ELECTRONICS 7

Binary code : B5 B4 B3 B2 B1 B0

    

Gray code : G5 G4 G3 G2 G1 G0
vii) Gray to Binary code : Gray to binary code conversion is obtained by using rules as shown under.
Gray code : G5 G4 G3 G2 G1 G0
    
Binary code : B5 B4 B3 B2 B1 B0
1.5 Binary Arithmetic
1.5.1 Binary addition

A0 B0 Sum Carry
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1

1.5.2 Binary Subtraction

A0 B0 Difference Borrow
0 0 0 0
0 1 1 1
1 0 1 0
1 1 0 0

1.6 Negative Number Representation in Binary Number System


i) Sign Magnitude representation
ii) One’s compliment representation
iii) Two’s compliment representation.
1.6.1 Sign magnitude representation
Left most bit represent sign.
For example
Bn  1 Bn  2 Bn  3 ...........B2 B1 B0
   
Sign Magnitude

Note : Range = –(2n – 1–1) to + (2n – 1–1)


Example-1 :
110100
– 20   
20

0 10100
+ 20   20

Example-2 :
0  1000 

 0  0000 
Note : Zero has two Distinct representation in sign magnitude Representation.
1.6.2 One’s complement representation
When each bit of number is complemented, resulting number is one’s compliment of original number. One’s

www.digcademy.com digcademy@gmail.com
Number Systems DIGITAL ELECTRONICS 8

compliment of a number gives its negative number.


Example-1 :
(+20)10 (00010100)2 Original number
(–20)10  (11101011)2 one’s complement
Note : Range = –(2n – 1–1) to + (2n – 1–1)
Example 2 :
(+0)10  (0000) 2 

( 0)10  (1000) 2  Two distinct Representation of Zeros.
Note : 1’s complement representation of zero has two distinct representations.
Note : 1’s complement of 1’s complement of a number gives original number.
1.6.3 Two’s complement representation
2’s Complement of a number = 1’s complement of the number + 1
Note : 2’s compliment has unique representation of zero.
(0)10 = (0000)2
1 1 1 1 1's complement
 1
Finalcarry ignored  1 0 0 0 0 2 's complement

Range : – 2n – 1 to + (2n – 1–1)


Note : (–37)10 In 2’s compliment form

( 37)10  (00100101)2
1's complement 11011010 1'complement
1
2's complement 11011011  (37)10

Example 1 :
(–130)10 in 2’s complement.
(130)10 = (10000010)2
Maximum decimal value of number with 8 bit = – 28 – 1 = –128
Therefore for (–130)10 at least nine bits should be taken.
 (130)2 = (010000010)2
1's complement 101111101
1
2 's complement 101111110  (130)2
Objective Questions :
Which is wrong representation of –130 in binary
(a) 0111110 (b) 10111110
(c) 110111110 (d) 1110111110
Ans. (a)
Hint : Maximum number represented by 8 bits
= –(28– 1) = (– 128)10
Note : Two’s compliment of 2’s compliment of a number gives original number.
Example :
(4)10 = 0100

www.digcademy.com digcademy@gmail.com
Number Systems DIGITAL ELECTRONICS 9

1's complement 1011


1
2 's complement 1100  (4)10
(–4)10 = 1100
1's complement 0011
1
2 's complement 0100  (4)10 Original number
Note :- By 1´s and 2´s complement problem of subtraction can be solved by adder circuit.
1.7 Binary Subtraction using one’s complement
Rules of addition :
Case I : A – B :
A  Minuend
B  Subtrahend
1’s compliment of B is added to ‘A’
i) If end around carry is generated it is added to the result and result is a positive number and in its true
form.
Example :
(6)10 – (4)10
(4)10 = 0100
1’s compliment = 1011
(6)10 – (+4)10 = 0110
1011
0001
1 end around carry
0010  (2)10 true form

ii) If end around carry is not generated the result is negative and 1’s compliment of true result
Example :
(4)10 – (6)10
(6)10 = 0110
1’s complement = 1001
 4(4)10 – (6)10  0100
1001
1101  1's complement
Real Result : 0010
Case II : – A – B
One’s compliment of A and B are added.
If carry is generated that should be added to the result and result is in its 1’s compliment form.
Example :
(–4)10 – (6)10 = (– 10)10
Number bits required = 5
Note : Maximum number with 4 bits
– (24 – 1– 1) = –7 [|–10| > |–7|] + 4  00100
1’s complement ( –4)10 11011
(+ 6)10 00110
1’s complement 11001

www.digcademy.com digcademy@gmail.com
Number Systems DIGITAL ELECTRONICS 10

 (–4)10 + (–6)10  11011


11001
10100
1
10101 1's complement

True result  1010


1.8 Binary subtraction using 2’s complement
Case – 1 (A – B)
Minuend is added to 2’s compliment of subtrahend.
i) If carry is generated result is positive and in its true form carry is discarded.
ii) If carry is not generated result is negative and it is 2’s compliment of true value.
Case II : (– A – B)
Two’s compliment of both A and B are added
i) Carry generated is ignored
ii) Result is always negative and in 2’s compliment form
Note : Number of bits required in result should taken care (maximum number with n bits in 2’s compliment
form is – 2n – 1).
1.9 Binary multiplication
Convert the binary numbers into Decimal number and multiply and convert back the result in Binary form.
Steps :
Binary Decimal multiply  Result Binary
1.10 Binary Division
Convert the number in decimal find division and convert back quotient and remainder in binary form.
1.11 Arithmetic of octal numbers
Convert the numbers into binary number perform the arithmetic operations and convert back into octal
number.
1.12 Arithmetic of Hexadecimal numbers
Convert the numbers into binary number perform the arithmetic operations and convert back to hexadecimal
number.
1.13 BCD Arithmetic
1.13.1 BCD addition
Rules :
i) If result of addition contains invalid BCD add 0110 to that BCD.
ii) If carry is passed from lower BCD to next BCD add 0110 to that BCD.
Example 1 :
(80)BCD + (80)10

1000 0000
1000 0000
1 0000 0000
0110
1 0110
 0000

(1
6 0) BCD

Example 2 :
(88)BCD + (88)BCD

www.digcademy.com digcademy@gmail.com
Number Systems DIGITAL ELECTRONICS 11

1000 1000
1000 1000
1
1 0001 0000
0110 0110
1 0111
 0110

(1 7 6) BCD

Example 3 :
(23)BCD + (88)BCD

0010 0011
1000 1000
1010
 1011

invalid BCD invalid BCD

Step  I 1 0110
1011 0001
Step  II 0110
1 0001
 0001

(1
1 1)BCD

Example 4 :
(76)BCD + (86)BCD

0111 0110
1000 0110
1111
 1100

invalid BCD invalid BCD

Step  I 1 0110
1 0000 0010
Step  II 0110
1 0110
 0010

(1 6 2)BCD

1.13.2 BCD Subtraction


Subtraction BCD is performed either by 9’s complement or by 10’s compliment. Rules are similar to binary
subtraction with 1’s and 2’s compliment.
1.14 XS-3 Arithmetic
1.14.1 XS-3 addition
Steps :
i) Convert the given number to Excess-3 format.
ii) Now Add Excess -3 numbers
iii) If carry is generated by Excess- 3 code of 2 digits add (0011)2 to the sum of digits.
iv) If carry is not generated subtract 0011 from sum of two digits.
v) Subtracting (0011)2 is equivalent to adding (1101)2 or (13)10

www.digcademy.com digcademy@gmail.com
Number Systems DIGITAL ELECTRONICS 12

Example :
(38)10 + (44)10

0110 1011
0111 0111
0 1
1110 0010
 0011  0011
ignored 1 1011
 0101

(8 2)10

1.14.2 XS-3 Subtraction


Excess – 3 subtraction is done with 9’s compliment or 10’s compliments
1.15 The r’s Compliment & (r–1)’s complement
1.15.1 r’s complement
r’s complement of a positive number ‘N’ of n digits in integral part.
rn – N r  redix
where n is number of digits in integral part of the number.
Example :
i) 10’s complement of (52520)10 is
105 – 52520 = 47480 n = 5
ii) 10’s complement of (0.3267)10 is
(10° – 0.3267) = 0.6733
n = 1
iii) 2’s complement of (101100)2 is
(26)10 – 101100 = (1000000)2 – (101100)2 = 010100
iv) 2’s complement of (0.0110)2 is
2° – 0.0110 = 1– 0.0110 = (0.1010)2
1.15.2 (r–1)’s complement
(rn)’s complement of a number N with ‘n’ digits in integral part and m digits in fractional part is
(rn – r–m – N)
Example :
i) 9’s complement of (52520)10 is
(105 – 10–0 – 52520) = 47479
n = 5, m = 0
Note : Complement of complement of a number restore the original number.
1.15.3 Subtraction using r’s complement
Let M – N is subtraction to be found. Both are of base r :
Steps :
i) Add the minuend M to the r’s complememnt of the subtrahend N
ii) Inspect for an end carry
(a) If an end carry occurs discard it and result is positive.
(b) If an end carry does not occur, result is negative and is r’s complement of true result.
1.15.4 Subtraction using (r-1)’s complement
Let M – N is found with (r – 1)’s complement.
i) Add minuend M to (r – 1)’s complement of subtrahend N.
ii) (a)If an end carry is generated add it to the sum and result is positive and in its true form.
(b)If an end carry is not generated result is –ve and in its (r – 1)’s complement form.


www.digcademy.com digcademy@gmail.com
Number Systems DIGITAL ELECTRONICS 13

Objective Questions

Q.1 How many 1’s are present in the binary representation of


(4  4096) + (9  256) + (7  16) + 5?
(a) 8 (b) 9
(c) 10 (d) 11
IES (EE)
Q.2 Match List-I (Binary) with List-II (Decimal) and select the correct answer using the codes given below the
lists :
List-I List-II
A. 10101010 1. 128
B. 11110000 2. 240
C. 10001000 3. 170
D. 10000000 4. 136
Codes :
A B C D
(a) 3 2 4 1
(b) 2 3 1 4
(c) 2 4 1 3
(d) 3 1 2 4
IES (EE)
Q.3 The number of digit 1 present in the binary representation of 3  512 + 7  64 + 5  8 + 3 is
(a) 8 (b) 9
(c) 10 (d) 12
IES (E & T)
Q.4 What is the octal equivalent of decimal 0.3125?
(a) 0.42 (b) 0.3125
(c) 0.24 (d) 0.12
IES (E & T)
Q.5 Match List-I (Octal) with List-II (Binary) and select the correct answer using the codes given below the
lists :
List-I List-II
A. 75 1. 010110
B. 65 2. 110101
C. 37 3. 111101
D. 26 4. 011111
Codes :
A B C D
(a) 3 1 4 2
(b) 2 1 3 4
(c) 3 2 4 1
(d) 4 2 3 1
IES (E & T)
Q.6 In hexadecimal arithmetic, the result of 7716 – 3B16 is equal to
(a) 3D16 (b) 3C16
(c) 6016 (d) 7316
IES (E & T)
Q.7 Which of the following represents ‘E316’ ?
(a) (1CE)16 + (A2)16 (b) (1BC)16 - (A2)16
(c) (2BC)16 - (1DE)16 (d) (200)16 - (11D)16
IES (E & T)
Q.8 Which of the following is incorrect ?

www.digcademy.com digcademy@gmail.com
Number Systems DIGITAL ELECTRONICS 14

(a) 111002 - 100012 = 001012 (b) 15E16 = 35010


(c) 8110 = 10100012 (d) 37.48 = 011 111 .100
IES (E & T)
Q.9 The decimal equivalent of hexadecimal number 2A0F is
(a) 17670 (b) 17607
(c) 17067 (d) 10767
IES (EE)
Q.10 The binary equivalent of hexadecimal number 4 F 2 D is
(a) 0101 1111 0010 1100
(b) 0100 1111 0010 1100
(c) 0100 1110 0010 1101
(d) 0100 1111 0010 1101
IES (EE)
Q.11 Match list-I (Hexadecimal) with list-II (Octal) and select the correct answer by using the codes given below
the lists:
List-I List-II
A. 68 1. 150
B. 8C 2. 214
C. 4F 3. 117
D. 5D 4. 135
Codes :
A B C D
(a) 3 1 4 2
(b) 1 2 3 4
(c) 3 2 4 1
(d) 4 1 2 3
IES (EE)
Q.12 F’s complement of (2BFD)hex is
(a) E 304 (b) D 403
(c) D 402 (d) C 403
Q.13 What are the values respectively, of R1 and R2 in the expression
(235)R1 = (565)10 = (865)R2?
(a) 8, 16 (b) 16, 8
(c) 6, 16 (d) 12, 8
IES (EE)
Q.14 The binary representation 100110 is numerically equivalent to the
1. Decimal representation 46
2. Octal representation 46
3. Hexadecimal representation 26
4. Excess-3 representation 13
Select the correct answer using the codes given below:
(a) 1 and 2 (b) 2 and 3
(c) 1 and 3 (d) 2 and 4
IES (EE)
Q.15 Given (125)R = (203)5, the value of radix R will be
(a) 16 (b) 10
(c) 8 (d) 6
IES (EE)
Q.16 If (327)9 = (x)5, then the value of x is given by
(a) 327 (b) 268
(c) 2033 (d) 3302

www.digcademy.com digcademy@gmail.com
Number Systems DIGITAL ELECTRONICS 15

(IAS)
Q.17 If (211)x = (152)8, then the value of base ‘x’ is
(a) 3 (b) 5
(c) 7 (d) 9
(IAS)
Q.18 Which of the following is a self-complementing code?
(a) 8421 code (b) Excess 3 code
(c) Pure binary code (d) Gray code
(IAS)
Q.19 The parity bit is added for.....purposes
(a) coding (b) indexing
(c) error-detection (d) controlling
IES (E & T)
Q.20 Which one of the following is a non-valid BCD code?
(a) 0111 1001 (b) 0101 1011
(c) 0100 1000 (d) 0100 1001
IES (EE)
Q.21 The binary number 00001011 when represented in BCD format, is given by
(a) 00001011 (b) 10111011
(c) 00010001 (d) 10001000
(IAS)
Q.22 When two numbers are added in excess-3 code and the sum is less than 9, then in order to get the correct
answer it is necessary to
(a) subtract 0011 from the sum (b) add 0011 to the sum
(c) subtract 0110 from the sum (d) add 0110 to the sum
IES (E & T)
Q.23 If two numbers in excess-3 code are added and the result is less than 9. then to get equivalent binary
(a) 0011 is subtracted (b) 0011 is added
(c) 0110 is subtracted (d) 0110 is added
Q.24 Gray code of the decimal number 13 is :
(a) 1010 (b) 1101
(c) 1011 (d) 1001
(UPPCS)
Q.25 The binary representation 100110 is numberically equivalent to:
(a) the decimal representation 46
(b) the octal representation 46
(c) the octal representation 26
(d) the decimal representation 26
(MPPCS)
Q.26 the number 7F in Hexadecimal number system is equivalent to the decimal number:
(a) 255 (b) 256
(c) 128 (d) 127
(RAS)
Q.27 Decimal 43 in Hexadecimal and BCD number system is respectively
(a) B2, 0100 0011 (b) 2B, 0100 0011
(c) 2B, 0011 0100 (d) B2, 0100 0100
GATE (E & T)
Q.28 The decimal value 0.25
(a) is equivalent to the binary value 0.1
(b) is equivalent to the binary value 0.01
(c) is equivalent to the binary value 0.00111
(d) cannot be represented precisely in binary

www.digcademy.com digcademy@gmail.com
Number Systems DIGITAL ELECTRONICS 16

GATE (CS)
Q.29 Which of the following subtraction operations do not result in F16 ?
1. ( BA )16 - ( AB ) 16
2. ( BC )16 - ( CB )16
3. ( CB )16 - ( BC )16
Select the correct answer using the code give below:
(a) Only 1 and 2 (b) Only 1 and 3
(c) Only 2 and 3 (d) 1,2 and 3
IES (E & T)
Q.30 What is the Gray code word for the binary number 101011?
(a) 101011 (b) 110101
(c) 011111 (d)111110
IES (E & T)
Q.31 Given (135)base x + (144)base x = (323)base x.
What is the value of base x ?
(a) 5 (b) 3
(c) 12 (d) 6
IES (E & T)
Q.32 A Gray code is a/an :
(a) Binary weighted code
(b) Arithmetic code
(c) Code which exhibits a single bit change between two successive codes
(d) Alphanumeric code
IES (E & T)
Q.33 The ASC II code is a
(a) 5-bit code (b) 7-bit code
(c) 9-bit code (d) 11-bit code
IES (E & T)
Q.34 Which of the following is error-correcting code?
(a) EBCDIC (b) GRAY
(c) Hamming (d) ASCII
IES (E & T)
Q.35 The decimal equivalent of the hexadecimal number (3 E 8)16 is
(a) 1000 (b) 982
(c) 768 (d) 323
IES (E & T)



www.digcademy.com digcademy@gmail.com
Number Systems DIGITAL ELECTRONICS 17

Answers & Explanations

Q.1 Ans. (a)


We have to find out the number of 1’s in the binary representation of (4 × 4096) + (9 × 256) + (7 ×16) + 5
This is a decimal number
Now, we can write this decimal number as
4 × 163 + 9 × 162 + 7 × 161 + 5 × 16°  (4975)16
then we convert this hexadecimal number into binary
(4 9 7 5)16

(0 1 0 0 1 0 0 1 0 1 1 1 0 1 0 1)2

then total number of 1s are 8


Q.2 Ans. (a)
A) (1 0 1 0 1 0 1 0)2
then its decimal equivalent will be
N = 1 × 27 + 0 × 26 + 1 × 25 + 0 × 24 + 1 × 23 + 0 × 22 + 1 × 21
+ 0 × 20
 N = 1 × 27 + 1 × 25 + 1 × 23 + 1 × 21
 N = 128 + 32 + 8 + 2 = (170)10
B) (1 1 1 1 0 0 0 0)2
then its decimal equivalent will be
N = 1 × 27 + 1 × 26 + 1 × 25 + 1 ×
2 4 + 0 × 23 + 0 × 2 2 + 0 × 21
+ 0 × 20
 N = 1 × 27 + 1 × 26 + 1 × 25
+ 1 × 24
 N = (240)10
C) (1 0 0 0 1 0 0 0)2
then its decimal equivalent will be
N = 1 × 27 + 0 × 26 + 0 × 25 + 0 × 24 + 1 × 23 + 0 × 22
+ 0 × 21 + 0 × 20
N = 1 × 128 + 1 × 8
= 128 + 8
= (136)10
D) (1 0 0 0 0 0 0 0)2
then its decimal equivalent will be
N = 1 × 27 + 0 × 26 + 0 × 25
+ 0 × 24 + 0 × 23 + 0 × 22
+ 0 × 21 + 0 × 20
N = 1 × 27
= (128)10
Q.3 Ans. (b)
We have to find out the total number of 1s in the binary representation of the decimal number
(3 × 512 + 7 × 64 + 5 × 8 + 3)10
= 3 × 83 + 7 × 82 + 5 × 81 + 3 × 80
= (3753)8
Now convert this octal number into binary

www.digcademy.com digcademy@gmail.com
Number Systems DIGITAL ELECTRONICS 18

(3 7 5 3)8

(0 1 1 1 1 1 1 0 1 0 1 1)2

then total number of 1s will be 9


Q.4 Ans.(c)
A fractional decimal number is converted to its equivalent octal number by successive multiplication by 8 as
follows
Generated
Integer
0.3125 × 8 = 2.5000 2
.5000 × 8 = 4.0000 4
·0000 × 8 = 0.0000 0

The process is terminated when zeros or significant digits are obtained


Thus octal equivalent of (0.3125)10 is (0.24)8
Q.5 Ans. (c)
For obtaining the binary equivalent of an octal number, each significant digit in the given number is replaced
by its 3 bit binary equivalent.
A) (75)8 = 75 = (1 1 1 1 0 1)21 1 11 0 1
B) (65)8 = 65 = (1 1 0 1 0 1)2 1 1 01 0 1
C) (37)8 =37 = (0 1 1 1 1 1)2 0 1 11 1 1
D) (26)8 = 26 =(0 1 0 1 1 0)2 0 1 01 1 0
Note :– For octal to binary conversion ratio 4 : 2 : 1 is used
4 : 2 :1
Example :– 0=000
1=001
2=010
3=011
4=100
5=101
6=110
7=111
Q.6 Ans. (b)
Method-I :– (77)16 = 7 × 161 + 7 × 160
= 112 + 7 = (119)10
(3 B)16 = 3 × 161 + B × 160
= 3 × 161 + 11 × 160 = 48 + 11
= (59)10
(77)16 – (3 B)16 = (119)10 – (59)10 = (60)10
Now we can convert 60 from decimal to hexadecimal by dividing it by 16.
16 60
16 3 12
= (3C)16
3
Method-II :–

16 16  7  23
7 7
7  B  23  B
– 3 B
3 C  23  11  12  C
 (77)16 – (3 B)16 = (3C)16

www.digcademy.com digcademy@gmail.com
Number Systems DIGITAL ELECTRONICS 19

Note :– The operation is same as that in decimal except that here 16 is used instead of 10
Q.7 Ans.(d)
Method-I :–
(E 3)16 = E × 161 + 3 × 160
= 14 × 161 + 3 × 160
= (227)10
(a) (1CE)16=1 × 162 + C × 161 + E × 160
= 1 × 162 + 12 × 161 + 14 × 160
= (462)10
(A 2)16 = A × 161 + 2 × 160
= 10 × 16 + 2 × 160
= (162)10
(1 C E)16 + (A 2)16 = 462 + 162
= (624)10
(b) (1 B C)16 – (A 2)16
= (1 × 162 + B × 161 + C × 160) – (A × 161 + 2 × 160)
= (256 + 176 + 12)10 – (160 + 2)
= (444) – (162)
= (282)10
(c) (2 B C)16 – (1 D E)16
= (2 × 162 + B × 161 + C × 160) – (1 × 162 + D × 161 + E × 160)10
= (512 + 176 + 12)10 – (256 + 208 + 14)10
= (700)10 – (478)10
= (222)10
(d) (200)16 – (1 1D)16
= (2 × 162)10 – (1 × 162 + 1 × 16 + D × 160)
= (512)10 – (285)10
= (227)10
Hence (E 3)16 = (200)16 – (1 1 D )16
Method-II :–
(a) (1CE)16 + (A2)16 = (270)16

E  2  16
 LSB  16  16  0
1 C E
+ A 2 1  C  A  1  12  10
2 7 0  23  16  7
11  2

(b) (1BC)16 – (A2)16 = (11A)16


(c) (2BC)16 – (1DE)16 = (DE)16
(d) (200)16 – (11D)16 = (E3)16
Q.8 Ans. (a)

LSB
0  1  1with borrow1
0  0  0, 0  1  1with borrow1
–1 –1 1  0  1,1  1  0
a) 1 1 1 0 0
1 0 0 0 1 1 1  0
0 1 0 1 1 MSB

www.digcademy.com digcademy@gmail.com
Number Systems DIGITAL ELECTRONICS 20

Hence
(1 1 1 0 0)2 – (1 0 0 0 1)2 = (0 1 0 1 1)2
alternative (a) is incorrect
(b) (15 E)16 = (350)10
The conversion from an hexadecimal to a decimal number can be carried out by multiplying each significant
digit of the hexadecimal by its repective weight and adding the products
 (15 E)16 = 1 × 162 + 5 × 161 + E × 160
= 256 + 80 + E
= 256 + 80 + 14
= (350)10
Hence (b) is correct
(c) (81)10 = (1 0 1 0 0 0 1)2
A decimal number is converted to binary number ny dividing the decimal number by 2 progressively,untill the
quotient of zero is obtained

2 81
2 40 1
2 20 0
2 10 0
2 5 0
2 2 1 = (1 0 1 0 0 0 1)2
2 1 0
1

(c) is correct
(d) (37.4)8 = (0 1 1 1 1 1.1 0 0)2
For obtaining the binary equivalent of an octal number, each significant digit in the given number is replaced
by its 3 bit binary equivalent using ratio 4 : 2 : 1
(37.4)8 = 37 .4
0 1 1 1 1 1 .100
= (0 1 1 1 1 1 . 1 0 0)2
Hence (d) is correct
Q.9 Ans. (d)
The conversion from hexadecimal to a decimal number can be carried out by multiplying each significant digit
of the hexadecimal by its respective weight and adding the products
3 2 1 0
(216 A16 016 F16 )16 = 2 × 163 + A × 162 + 0 × 161 + F × 160
= 8192 + 2560 + 0 + 15
= (10767)10
Q.10 Ans. (d)
To convert a hexadecimal number into its binary equivalent, each significant digit in the given number is
replaced by its 4 bit binary equivalent
(4 F 2 D)16  (x)2
4 F 2 D
0100 1111 0010 1101
= (0 1 0 0 1 1 1 1 0 0 1 0 1 1 0 1)2
Note :– For Hexadecimal to binary, we use the ratio 8 : 4 : 2 : 1
Q.11 Ans. (b)
To convert a hexadecimal number to octal, the following steps can be applied
i) Convert the given hexadecimal to its binary equivalent
ii) From groups of 3 bits, starting from LSB

www.digcademy.com digcademy@gmail.com
Number Systems DIGITAL ELECTRONICS 21

iii) Write the equivalent octal number for each group of 3 bits
A) 68 = 6 8
0110 1000
= 01101000
Now forming groups of 3 bits from LSB
add 0 001 101 000
1 5 0
Hence (68)16  (150)8
B) 68 = 8 C
1000 1100
Forming groups of 3 bits we get
add 0 010 001 100
2 1 4
 (8C)16  (214)8
C) 4F = 4 F
0100 1111
Forming groups of 3 bits, we get
add 0 001 001 111
1 1 7
 (4 F)16  (117)8
D) 5D = 5 D
0101 1101
Forming groups of 3 bits, we get
add 0 001 011 101
1 3 5
 (5 D)16  (135)18
Note :– Inserting 0 at the left most side of a number does not alter it
For example :– 145 or 0145 have same meaning.
Q.12 Ans. (c)
In hexadecimal system F represents 15
F´s complement is obtained by subtracting each digit of the given number from 15.
(2 BFD)hex = (2 BFD)16
15 – 2 = 13 = D in hexadecimal
15 – B = 15 – 11 = 4
15 – F = 15 – 15 = 0
15 – D = 15 – 13 = 2
Hence F´S complement of (2 BFD)16 is D402
Q.13 Ans. (b)
(235)R1 = (565)10
Let us convert (235)R from base R1 to decimal equivalent
1

2  R  3  R  5  R 10 = 565
2
1
1
1

2 R 12  3R 1  5 = 565
 2 R 12  3 R 1 – 560 = 0
 R 1 = 16
70
or 
4
 R 1 = 16
Now (565)10 = (865) R 2

www.digcademy.com digcademy@gmail.com
Number Systems DIGITAL ELECTRONICS 22

Similarly (865) R is converted to its decimal equivalent as


2

8  R  6  R 2  5  R 02 = 565
2
2

8 R 22  6R 2 – 560 = 0
 R2 = 8
70
or 
8
 R2 = 8
Q.14 Ans. (b)
1. (1 0 0 1 1 0)2= 1 × 25 + 0 × 24 + 0 × 23 + 1 × 22 + 1 × 21 + 0 × 20
= 32 + 4 + 2
= 38
 (1 0 0 1 1 0)2 = (38)10
2. 1 0 0 1 1 0 Forming groups of 3 bits
4 6
 (1 0 0 1 1 0)2  (46)8
3. By forming groups of 4 bits, we get
0010 0110

2 6
 (1 0 0 1 1 0)2  (26)16
4. Decimal = 1 3
Add 3 to each bit = + 3 +3
4 6
Converting the above sum into its BCD
we have
Sum  4 6
 
BCD 0100 0110

Hence excess-3 representation of 13 is (1 0 0 0 1 1 0). not 1 1 0 1 1 0


Hence alterntives (b) and (c) are correct only.
Q.15 Ans. (d)
(125)R = (203)5
We convert both sides into decimal equivalents
1 × R2 + 2 R1 + 5 × R0 = 2 × 52 + 0 × 51 + 3 × 50
 R2 + 2 R + 5 = 50 + 3
 R2 + 2 R – 48 = 0
2
 R + 8 R – 6 R – 48 = 0
 R(R + 8) – 6 (R + 8) = 0
 R = 6,– 8
Hence positive value of R is 6 which is radix.
Q.16 Ans. (c)
(327)9 = (x)5
To get value of x, we first convert left side into its decimal equivalent.
(327)9 = 3 × 92 + 2 × 91 + 7 × 90
= 243 + 18 + 7
= (268)10
Now we convert this decimal number into base 5 by 5 progressively

www.digcademy.com digcademy@gmail.com
Number Systems DIGITAL ELECTRONICS 23

Generated
5 268 Integer
3
5 53
3
5 10

5 2
0 = (2033)5
2

Hence x = 2033
Note :– Any number with any base r can be converted to decimal number and vice- versa.
1. Decimal to Base r :– For integer part divide the decimal number by r progressively. For fractional part
multiply by r progressively
2. Base r to Decimal :– Multiply each digit by its corresponding weight and add all
Q.17 Ans. (c)
(211)x = (152)8
To get value of x, we convert both sides into their corresponding decimal equivalents
(211)x = 2 × x2 + 1 × x1 + 1 × x0
= 2x2 + x + 1
(152)8 = 1 × 82 + 5 × 81 + 2 × 80
= 106
Now 2x2 + x + 1 = 106
 2x2 + x – 105 = 0
2
 2x + 15x – 14x – 105 = 0
 2x2 – 14x + 15x – 105 = 0
 2x (x – 7) + 15 (x – 7) = 0
 x = 7,
15
x = 
2
Since radix is a positive integer
 x = 7
Q.18 Ans. (b)
The Excess – 3 code is a self complementing code.
Note :– 2421 code is also a self complementing code.
Note :– A code is called a self complementing code if 1´s complement of the coded number yield 9´s complement of
the number itself.
Q.19 Ans. (c)
During the process of binary data transmission errors may occur. In order to detect errors, error-detecting
codes are used. The simplest error detecting method is the parity check, in which an extra parity bit is
included with the binary message to make the total number of 1’s either odd or even, resulting in two methods.
1. Even-parity method :– The total number of 1’s in the code group (including the parity bit) must be an
even number.
2. Odd parity method :–The total number of 1’s (including parity bit) must be an odd number.
N ote :– The parity bit can be placed at either end of the code word, such that the receiver should be able to
understand the parity bit and the actual data
Q.20 Ans. (b)
The Binary Code Decimal (BCD) is a combination of 4 binary digits that represent decimal numbers. The
weights are assigned according to the positions occupied by these digits. The weights are 8-4-2-1 and hence
it is called 8421 code

www.digcademy.com digcademy@gmail.com
Number Systems DIGITAL ELECTRONICS 24

Decimal Number BCD 


0 0 00 0 

1 0 001 
2 0 010 
3 0 011 

4 0100  These all are valid BCDs
5 0101 

6 0110 
7 0111 
8 10 00 

9 10 01 

but now for decimals above 9 if we apply 8-4-2-1, we get invalid BCDS
For example
10  1 0 1 0 is an invalid BCD
11  1 0 1 1 is an invalid BCD
ans so on
The valid BCD code for 10 is written as
1 0
0 0 0 1 0 0 0 0

1 1
0 0 0 1 0 0 0 1
The same procedure is followed to get valid BCD codes for all decimals above 9.
Thus among the given alternatives 0 1 0 1 1 0 1 1 is an valid BCD
Q.21 Ans. (c)
The binary number 0 0 0 0 1 0 1 1 represents decimal 11.
Hence BCD code for 11 is
0 0 01 0 0 01
Q.22 Ans.(a)
When two numbers are added in excess –3 code and the sum is less than 9 then in order to get the correct
answer it is necessary to subtract 0011from the sum.
Q.23 Ans. (a)
Q.24 Ans. (c)
Binary equivalent of 13 is 1101. Now we convert this binary number to Gray code as follows
11
1+1=0
1 + 1 + 0 +1 1+0=1
0+1=1
1 0 1 1

Hence (13)10 = (1011)G


Q.25 Ans. (b)
(100110)2 = 1 × 25 + 0 + 0 + 1 × 22 + 1 × 21 + 0
= 32 + 4 + 2
= (38)10
100 110

4 6
Hence (100110)2 = (46)8
Q.26 Ans. (d)

www.digcademy.com digcademy@gmail.com
Number Systems DIGITAL ELECTRONICS 25

(7F)16 = 7 × 161 + F × 16°


= 7 × 161 + 15 × 1
= 112 + 15
= (127)10
Q.27 Ans. (b)
(43)10 = (x)16
16 43
2 11 = (2 B)
2

 (43)10 = (2 B)16
BCD equivalent of 43 is 0100 0011
Q.28 Ans. (b)
Integer
0.25 × 2 = 0.50 0
× 
× 2 = 0.00 0
 (0.25)10 = (0.01)2
Q.29 Ans. (d)
1. (BA)16 – (AB)16 = (186)10 – (171)10
= (15)10
= F
2. (BC)16 – (CB)16 = (188)10 – (203)10
= –(15)10
= –F
3. (CB)16 – (BC)16 = (203)10 – (188)10
= (15)10
= F
So none of 1,2 and 3 result in F16
Q.30 Ans. (d)
Binary
1 0 1 0 1 1

1 1+0 0+1 1+0 0+1 1+1

1 1 1 1 0 Gray

 (101011)2 = (111110)G
Q.31 Ans.(d)
(135)x + (144)x = (323)x
By converting both sides in base 10, we get
x2 + 3x + 5 + x2 + 4x + 4 = 3x2 + 2x + 3
 x2 – 5x – 6 = 0
 x = 6, x = –1
Hence value of base x is 6
Q.32 Ans. (c)
The Gray code belongs to a class of codes called minimum change codes, in which only one bit in the code
group changes when moving from one step to the next. The Gray code is a non weighted code. It is also
called a unit distance code.
Q.33 Ans. (b)
ASCII :– American Standards Code for Information Interchange).
It is alphanumeric code.

www.digcademy.com digcademy@gmail.com
Number Systems DIGITAL ELECTRONICS 26

It represents a character with 7 bits which can be stored as one byte with one bit unused.
It is 7 bit code
Q.34 Ans. (c)
(a) EBCDIC :– (Extended Binary Coded Decimal Information Code) is an alphanumeric code is used in
IBM.
It uses 8 bits for each character and a 9th bit for parity.
(b) Gray Code :– It is non-weighted code. It is also called minimum change code.It is also called unit-
distance code.
(c) Hamming Code :– Hamming Code is an error correcting code
(d) ASCII :– (American Standard Code for Information Interchange). It is an alphanumeric code. The
ASCII code represnets a character with 7 bits, which can be stored as one byte with one bit unused.
Q.35 Ans. (a)
(3 E 8)16 = (x)10
(3 E 8)16 = 3 × 162 + E × 161 + 8 × 160
= 3 × 162 + 14 × 161 + 8 × 160
= 768 + 224 + 8
= (1000)10



www.digcademy.com digcademy@gmail.com

You might also like