Chapter 2: Data Representation
Introduction
- As we know that computer system stores any data in binary form that’s why we use to add the word DIGITAL with all the work related to computer. The data stored in computer is knows as Digital Data.
- In this chapter we will see various techniques to represent data in a computer system.
- Human beings have adopted Decimal Number System in their day to day life. In the same manner, computer system has adopted Binary Number System, Octal Number System and Hexadecimal Number System which are combinedly known as Digital Number System.
These Number Systems
are -
Decimal Number System
Decimal system is consists of 10 digits
which are as under
•
0,1,2,3,4,5,6,7,8,9
Base of this system is 10 and it is to be shown as-
•
(5479)10
486 = 4 X 102 + 8 X 101 + 6 X 100
- The left most digit is called MSD (Most Significant Digit ).
- The right most digit is called LSD (Least Significant Digit )
Binary Number System
Binary system consists of 2 digits 0,1 known as bit. Base of this system is 2 and it is to be shown as (1001010101)2
1010 = 1 X 23 + 0 X 22 + 1 X 21 + 0 X 20
10.11 = 1 X 21 + 0 X 20 + 1 X 2-1 + 1 X 2-2
- The left most digit is called MSB (Most Significant Bit ).
- The right most digit is called LSB (Least Significant Bit ).
Octal Number System
Octal system consists of 8 digits which are as under.- 0,1,2,3,4,5,6,7
2256 =2 X 83 + 2 X 82 + 5 X 81 + 6 X 80
Hexadecimal Number System
Octal system consists of 16 digits which are as under.- 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
Base of this system is 16 and it is to be shown as (BCD54)16
AC23 =10 X 163 + 12 X 162 + 2 X 161 + 3 X 160
Question 1
What are the bases of decimal, octal, binary and hexadecimal systems ?
Answer
The bases are:
- Decimal — Base 10
- Octal — Base 8
- Binary — Base 2
- Hexadecimal — Base 16
Question 2
What is the common property of decimal, octal, binary and hexadecimal number systems ?
Answer
Decimal, octal, binary and hexadecimal number systems are all positional-value system.
Question 3
Complete the sequence of following binary numbers : 100, 101, 110, ............... , ............... , ............... .
Answer
100, 101, 110, 111 , 1000 , 1001 .
Question 4
Complete the sequence of following octal numbers : 525, 526, 527, ............... , ............... , ............... .
Answer
525, 526, 527, 530 , 531 , 532 .
Question 5
Complete the sequence of following hexadecimal numbers : 17, 18, 19, ............... , ............... , ............... .
Answer
17, 18, 19, 1A , 1B , 1C .
Question 6
Convert the following binary numbers to decimal and hexadecimal:
(a) 1010
(b) 111010
(c) 101011111
(d) 1100
(e) 10010101
(f) 11011100
Answer
(a) 1010
Converting to decimal:
Binary No | Power | Value | Result |
---|---|---|---|
0 (LSB) | 20 | 1 | 0x1=0 |
1 | 21 | 2 | 1x2=2 |
0 | 22 | 4 | 0x4=0 |
1 (MSB) | 23 | 8 | 1x8=8 |
Equivalent decimal number = 8 + 2 = 10
Therefore, (1010)2 = (10)10
Converting to hexadecimal:
Grouping in bits of 4:
Binary Number | Equivalent Hexadecimal |
---|---|
1010 | A (10) |
Therefore, (1010)2 = (A)16
(b) 111010
Converting to decimal:
Binary No | Power | Value | Result |
---|---|---|---|
0 (LSB) | 20 | 1 | 0x1=0 |
1 | 21 | 2 | 1x2=2 |
0 | 22 | 4 | 0x4=0 |
1 | 23 | 8 | 1x8=8 |
1 | 24 | 16 | 1x16=16 |
1 (MSB) | 25 | 32 | 1x32=32 |
Equivalent decimal number = 32 + 16 + 8 + 2 = 58
Therefore, (111010)2 = (58)10
Converting to hexadecimal:
Grouping in bits of 4:
Binary Number | Equivalent Hexadecimal |
---|---|
1010 | A (10) |
0011 | 3 |
Therefore, (111010)2 = (3A)16
(c) 101011111
Converting to decimal:
Binary No | Power | Value | Result |
---|---|---|---|
1 (LSB) | 20 | 1 | 1x1=1 |
1 | 21 | 2 | 1x2=2 |
1 | 22 | 4 | 1x4=4 |
1 | 23 | 8 | 1x8=8 |
1 | 24 | 16 | 1x16=16 |
0 | 25 | 32 | 0x32=0 |
1 | 26 | 64 | 1x64=64 |
0 | 27 | 128 | 0x128=0 |
1 (MSB) | 28 | 256 | 1x256=256 |
Equivalent decimal number = 256 + 64 + 16 + 8 + 4 + 2 + 1 = 351
Therefore, (101011111)2 = (351)10
Converting to hexadecimal:
Grouping in bits of 4:
Binary Number | Equivalent Hexadecimal |
---|---|
1111 | F (15) |
0101 | 5 |
0001 | 1 |
Therefore, (101011111)2 = (15F)16
(d) 1100
Converting to decimal:
Binary No | Power | Value | Result |
---|---|---|---|
0 (LSB) | 20 | 1 | 0x1=0 |
0 | 21 | 2 | 0x2=0 |
1 | 22 | 4 | 1x4=4 |
1 (MSB) | 23 | 8 | 1x8=8 |
Equivalent decimal number = 8 + 4 = 12
Therefore, (1100)2 = (12)10
Converting to hexadecimal:
Grouping in bits of 4:
Binary Number | Equivalent Hexadecimal |
---|---|
1100 | C (12) |
Therefore, (1100)2 = (C)16
(e) 10010101
Converting to decimal:
Binary No | Power | Value | Result |
---|---|---|---|
1 (LSB) | 20 | 1 | 1x1=1 |
0 | 21 | 2 | 0x2=0 |
1 | 22 | 4 | 1x4=4 |
0 | 23 | 8 | 0x8=0 |
1 | 24 | 16 | 1x16=16 |
0 | 25 | 32 | 0x32=0 |
0 | 26 | 64 | 0x64=0 |
1 (MSB) | 27 | 128 | 1x128=128 |
Equivalent decimal number = 1 + 4 + 16 + 128 = 149
Therefore, (10010101)2 = (149)10
Converting to hexadecimal:
Grouping in bits of 4:
Binary Number | Equivalent Hexadecimal |
---|---|
0101 | 5 |
1001 | 9 |
Therefore, (101011111)2 = (95)16
(f) 11011100
Converting to decimal:
Binary No | Power | Value | Result |
---|---|---|---|
0 (LSB) | 20 | 1 | 0x1=0 |
0 | 21 | 2 | 0x2=0 |
1 | 22 | 4 | 1x4=4 |
1 | 23 | 8 | 1x8=8 |
1 | 24 | 16 | 1x16=16 |
0 | 25 | 32 | 0x32=0 |
1 | 26 | 64 | 1x64=64 |
1 (MSB) | 27 | 128 | 1x128=128 |
Equivalent decimal number = 4 + 8 + 16 + 64 + 128 = 220
Therefore, (11011100)2 = (220)10
Converting to hexadecimal:
Grouping in bits of 4:
Binary Number | Equivalent Hexadecimal |
---|---|
1100 | C (12) |
1101 | D (13) |
Therefore, (11011100)2 = (DC)16
Question 7
Convert the following decimal numbers to binary and octal :
(a) 23
(b) 100
(c) 145
(d) 19
(e) 121
(f) 161
Answer
(a) 23
Converting to binary:
2 | Quotient | Remainder |
---|---|---|
2 | 23 | 1 (LSB) |
2 | 11 | 1 |
2 | 5 | 1 |
2 | 2 | 0 |
2 | 1 | 1 (MSB) |
0 |
Therefore, (23)10 = (10111)2
Converting to octal:
8 | Quotient | Remainder |
---|---|---|
8 | 23 | 7 (LSB) |
8 | 2 | 2 (MSB) |
0 |
Therefore, (23)10 = (27)8
(b) 100
Converting to binary:
2 | Quotient | Remainder |
---|---|---|
2 | 100 | 0 (LSB) |
2 | 50 | 0 |
2 | 25 | 1 |
2 | 12 | 0 |
2 | 6 | 0 |
2 | 3 | 1 |
2 | 1 | 1 (MSB) |
0 |
Therefore, (100)10 = (1100100)2
Converting to octal:
8 | Quotient | Remainder |
---|---|---|
8 | 100 | 4 (LSB) |
8 | 12 | 4 |
8 | 1 | 1 (MSB) |
0 |
Therefore, (100)10 = (144)8
(c) 145
Converting to binary:
2 | Quotient | Remainder |
---|---|---|
2 | 145 | 1 (LSB) |
2 | 72 | 0 |
2 | 36 | 0 |
2 | 18 | 0 |
2 | 9 | 1 |
2 | 4 | 0 |
2 | 2 | 0 |
2 | 1 | 1 (MSB) |
0 |
Therefore, (145)10 = (10010001)2
Converting to octal:
8 | Quotient | Remainder |
---|---|---|
8 | 145 | 1 (LSB) |
8 | 18 | 2 |
8 | 2 | 2 (MSB) |
0 |
Therefore, (145)10 = (221)8
(d) 19
Converting to binary:
2 | Quotient | Remainder |
---|---|---|
2 | 19 | 1 (LSB) |
2 | 9 | 1 |
2 | 4 | 0 |
2 | 2 | 0 |
2 | 1 | 1 (MSB) |
0 |
Therefore, (19)10 = (10011)2
Converting to octal:
8 | Quotient | Remainder |
---|---|---|
8 | 19 | 3 (LSB) |
8 | 2 | 2 (MSB) |
0 |
Therefore, (19)10 = (23)8
(e) 121
Converting to binary:
2 | Quotient | Remainder |
---|---|---|
2 | 121 | 1 (LSB) |
2 | 60 | 0 |
2 | 30 | 0 |
2 | 15 | 1 |
2 | 7 | 1 |
2 | 3 | 1 |
2 | 1 | 1 (MSB) |
0 |
Therefore, (121)10 = (1111001)2
Converting to octal:
8 | Quotient | Remainder |
---|---|---|
8 | 121 | 1 (LSB) |
8 | 15 | 7 |
8 | 1 | 1 (MSB) |
0 |
Therefore, (121)10 = (171)8
(f) 161
Converting to binary:
2 | Quotient | Remainder |
---|---|---|
2 | 161 | 1 (LSB) |
2 | 80 | 0 |
2 | 40 | 0 |
2 | 20 | 0 |
2 | 10 | 0 |
2 | 5 | 1 |
2 | 2 | 0 |
2 | 1 | 1 (MSB) |
0 |
Therefore, (161)10 = (10100001)2
Converting to octal:
8 | Quotient | Remainder |
---|---|---|
8 | 161 | 1 (LSB) |
8 | 20 | 4 |
8 | 2 | 2 (MSB) |
0 |
Therefore, (161)10 = (241)8
EXCERCISE
A. Convert the following Hexadecimal numbers to Binary Number:
(a) A6
(b) A07
(c) 7AB4
(d) BE
(e) BC9
(f) 9BC8
B. Convert the following Decimal numbers to Binary Number:
(a) 543
(b) 796
(c) 1654
(d) 7654
(e) 7432
(f) 7453
C. Convert the following Binary numbers to Decimal Number:
(a) 1000111
(b) 111101
(c) 1010101
(d) 11011001
(e) 101010101
(f) 10001001
D. Convert the following Octal numbers to Decimal Number:
(a) 524
(b) 354
(c) 745
(d) 7532
(e) 1234
(f) 6524