I-42 Computer Fundamentals
10. What are the disadvantages of using BCD code? How do we remove this problem? Is BCD
code weighted code? If yes, then explain.
Ans: The disadvantages of using BCD code are as follows:
This coding is not sufficient for business purposes, as a 4-bit BCD code can represent only 16 (that is,
2
4
) symbols, even a 6-bit BCD code can also represent only 64 (that is, 2
6
) symbols.
The BCD representation of a decimal number requires more bits than its equivalent binary
representation. For example, the BCD code of decimal number 215 is 0010 0001 0101 (requires12
bits), while its binary equivalent is 1101 0111 (requires 8 bits). In general, a decimal number with
k digits requires 4k bits in BCD.
Computers using BCD codes could work only with upper case letters and 0 to 9 numbers and a
few characters. This is not sufficient for providing decimal numbers (10), lowercase letters (26),
uppercase letters (26) and a large number of other special characters (28+).
To remove above problems, the BCD code was extended from a 6-bit code to an 8-bit code, which comes
to known as Extended Binary Coded Decimal Interchange Code (EBCDIC). The added 2 bits are used
as additional zone bits, expanding the zone to 4 bits. Thus, it is possible to represent 256 (2
8
) different
characters instead of 64 (2
6
) by making use of EBCDIC.
Yes, BCD code is a weighted code, as it is possible to assign weights to the binary bits according to
their positions. The weights in the 4-bit BCD code are 8(2
3
), 4(2
2
), 2(2
1
) and 1(2
0
).
11. How do we convert binary numbers into gray codes?
Ans: A binary number is converted to its equivalent gray code by performing the following steps.
1. Take the MSB of the binary code as the MSB of the gray code word.
2. Starting from left to right, add each adjacent pair of bits in the binary code to get the next gray code
bit, while ignoring the carries.
For example, consider a binary number 10100111 that is to be converted to its equivalent gray code. The
required conversion is illustrated as follows.
Gray code
Binary code
1
1 1 1 1 1
1 1 1 10 0 0
0 0 0
+ + + + + + +
Thus, the required gray code is 11110100.
12. Convert the following:
(a) (0.4375)
10
to ( )
2
(b) (2AD)
16
to ( )
2
(c) (11100111101)
2
to ( )
16
(d) (1110101101)
2
to ( )
10
(e) (A2B.D8)
16
to ( )
10
Ans: (a) To convert (0.4375)
10
into binary form, multiply the fraction part (0.4375) by 2. Then, sepa-
rate the integer and fraction parts of the result. Repeat the above steps until the fraction part becomes
zero. Finally, write the integer parts (in downward direction) to form the binary equivalent of given
number. The conversion of (0.4375)
10
to binary is shown here.
M02_ITL-ESL4791_01_SE_C02.indd 42 12/22/2012 4:52:57 PM
Number Systems I-43
Integer part
.4375 × 2 = 0.875 0
.875 × 2 = 1.75 1 1
.75 × 2 = 1.5 1 1
.5 × 2 = 1.0 1 1
Thus, (0.4375)
10
= (0.0111)
2
.
(b) To convert (2AD)
16
to binary form, first replace each hexadecimal digit by its 4-bit binary equiva-
lent and then combine all the groups as shown in Table 2.6.
Table 2.6 Conversion of (2AD)
16
into Its Binary Form
Hexadecimal number 2 A D
Binary coded value 0010 1010 1101
Thus, (2AD)
16
= (001010101101)
2
.
(c) To convert (11100111101)
2
to its hexadecimal form, first divide it into 4-bit groups starting from
right to left and then replace each group by its hexadecimal equivalent as shown in Table 2.7.
Table 2.7 Conversion of (11100111101)
2
into Its Hexadecimal Form
Binary value 0111 0011 1101
Hexadecimal number 7 3 D
Thus, (11100111101)
2
= (73D)
16
.
(d) To convert (1110101101)
2
into its decimal equivalent, multiply each bit by its corresponding
binary weight and then add all the products as shown here.
(1110101101)
2
= 1 × 2
9
+ 1 × 2
8
+ 1 × 2
7
+ 0 × 2
6
+ 1 × 2
5
+ 0 × 2
4
+ 1 × 2
3
+ 1 × 2
2
+ 0 × 2
1
+ 1 × 2
0
= 512 + 256 + 128 + 0 + 32 + 0 + 8 + 4 + 0 + 1
= 941
Thus, (1110101101)
2
= (941)
10
(e) To convert (ABD.D8)
16
into its decimal equivalent, multiply each hexadecimal digit by its cor-
responding weight and then add all the products as shown here.
(A2B.D8)
16
= A × 16
2
+ 2 × 16
1
+ B × 16
0
+ D × 16
−1
+ 8 × 16
−2
= 10 × 16
2
+ 2 × 16
1
+ 11 × 16
0
+ 13 × 16
−1
+ 8 × 16
−2
= 2560 + 32 + 11 + 0.8125 + 0.03125
= 2603.84375
Thus, (A2B.D8)
16
= (2603.84375)
10
M02_ITL-ESL4791_01_SE_C02.indd 43 12/22/2012 4:52:57 PM
I-44 Computer Fundamentals
13. Convert the decimal number 59.8125 into binary and octal.
Conversion to Binary
The integer part of given decimal number (that is, 59) is converted to its binary equivalent as shown here.
2 59 Remainder
2 29 1 LSB
2 14 1
2 7 0
2 3 1
2 1 1
0 1 MSB
Thus, (59)
10
= (111011)
2
.
The fraction part of given decimal number (that is, .8125) is converted to its binary equivalent as shown here.
Integer part
0.8125 × 2 = 1.6250 1
0.625 × 2 = 1.250 1
0.25 × 2 = 0.50 0
0.5 × 2 = 1.0 1
Thus, (.8125)
10
= (.1101)
2
.
On combining the integer and fraction parts, we get (59.8125)
10
= (111011.1101)
2
.
Conversion to Octal
The integer part of given decimal number (that is, 59) is converted to its octal equivalent as shown here.
8 59 Remainder
8 7 3 LSB
0 7 MSB
Thus, (59)
10
= (73)
8
.
The fraction part of given decimal number (that is, .8125) is converted to its octal equivalent as shown here.
Integer part
0.8125 × 8 = 6.5 6
0.5 × 8 = 4.0 4
Thus, (0.8125)
10
= (0.64)
2
.
On combining the integer and fraction parts, we get (59.8125)
10
= (73.64)
8
.
14. Using 2s complement system perform (51)
10
− (27)
10
in binary.
Ans: First, convert (51)
10
into its binary equivalent as shown here.
M02_ITL-ESL4791_01_SE_C02.indd 44 12/22/2012 4:52:57 PM
Number Systems I-45
2 51 Remainder
2 25 1 LSB
2 12 1
2 6 0
2 3 0
2 1 1
0 1 MSB
Thus, (51)
10
= (110011)
2
.
Similarly, we can convert (27)
10
into binary form as shown here.
2 27 Remainder
2 13 1 LSB
2 6 1
2 3 0
2 1 1
0 1 MSB
After taking remainder bits from MSB to LSB, we have (11011)
2
.
Thus, (27)
10
= (11011)
2
.
Now, we have to perform (110011)
2
(11011)
2
using 2s complement. This operation is equivalent to
(110011)
2
+ 2s complement of (011011)
2
. The 2s complement of (011011)
2
is (100101)
2
. Thus, the addition
operation is performed as follows:
1 1 1 1 Carry
1 1 0 0 1 1
+ 1 0 0 1 0 1
1 0 1 1 0 0 0
Discard carry bit
Thus, the result is (11000)
2
.
15. Convert (A5B)
16
into octal.
Ans: To convert (A5B)
16
into its octal equivalent, first replace each hexadecimal digit by its 4-bit
binary equivalent, divide the number into 3-bit groups starting from right to left (add additional zeros to
the left if required) and then replace each 3-bit group by its octal equivalent.
(A5B)
16
= 1010 0101 1011
= 101 001 011 011
= 5133
Thus, (A5B)
16
= (5133)
8
.
Multiple-choice Questions
1. The most popular positional number system being used today is the .
(a) Decimal number system (b) Digital number system
(c) Binary number system (d) None of the above
M02_ITL-ESL4791_01_SE_C02.indd 45 12/22/2012 4:52:57 PM
I-46 Computer Fundamentals
2. The base for hexadecimal number is .
(a) 8
(b) 6
(c) 16
(d) 4
3. In an 8-bit unsigned binary number, each number added or subtracted must be between .
(a) 0 and 255
(b) 0 and 225
(c) 1 and 255
(d) 50 and 250
4. Which of the following is not a standard text code system?
(a) ASCII
(b) UNICODE
(c) EBCDIC
(d) LCD
5. EBCDIC stands for .
(a) Extended Binary Coded Decimal Internal Code
(b) Extended Binary Coded Decimal Interchange Code
(c) Extensive Binary Coded Decimal Internal Code
(d) Extended Binary Coded Decimal Interchange Calculation
Answers
1. (a) 2. (c) 3. (a) 4. (d) 5. (b)
M02_ITL-ESL4791_01_SE_C02.indd 46 12/22/2012 4:52:57 PM
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset