Correct Answer - Option 1 : BCD code
BCD (Binary Coded Decimal):
1) BCD (Binary Coded Decimal) is simply the 4-bit binary code representation of a decimal digit.
2) Each decimal digit replaced in the integer and fractional parts by its binary equivalent.
3) BCD Code uses four bits to represent the 10 decimal digits of 0 to 9.
4) BCD code is often called 8421 because the BCD is a weighted code and the weights used in binary coded decimal code are 8, 4, 2, 1.
5) The first 8-bit Extended Binary Coded Decimal Interchange Code (EBCDIC) introduced by IBM.
The following represents the 4-bit binary representation of decimal values:
Decimal Symbol
|
BCD Digit
|
0
|
0000
|
1
|
0001
|
2
|
0010
|
3
|
0011
|
4
|
0100
|
5
|
0101
|
6
|
0110
|
7
|
0111
|
8
|
1000
|
9
|
1001
|
ASCII code:
- The ASCII table has 128 characters, with values from 0 through 127.
- Thus, 7 bits are sufficient to represent a character in ASCII; however, most computers typically reserve 1 byte, (8 bits), for an ASCII character.
- One byte allows a numeric range from 0 through 255 which leaves room for growth in the size of the character set, or for a sign bit.
- Consequently, a character data type may optionally represent signed values;
- However, for now, we will assume that character data types are unsigned, i.e. positive integer values, in the range 0-127.