Data Representations

Data Representations
Data Representations
💡 Table of Contents

Data Representation refers to a form in which data is stored. Data and instruction command can’t be process directly in computers by human language. Computer first translate the human language into machine language for being processed out. In this blog post we will learn about data representation and also learn data conversion from on form to another one. 

◘ Types of Data Representation

Binary  Octal  Decimal  Hexadecimal

We cover every possible type of data conversion from one to another or vice-versa.

A number consist of two part i.e. Integer and fractional part.

For example-  169.124
169 is integer part and 0.124 is fractional part.

LSD stand for Least Significant Digit and MSD stand for Most Significant Digit.

*Add 0 to complete digit pairs.

◘ Binary Number System

A number system with base 2 and containing only two digits which are (0,1)

No. Binary Number

1 1

2 10

3 11

4 100

5 101

6 110

7 111

8 1000

9 1001

10 1010

11 1011

12 1100

13 1101

14 1110

15 1111

16 10000

17 10001

18 10010

19 10011

20 10100

*Only binary number system is used by computers.

In the above binary numbers table we can observe that  1=1, 3=11, 7=111, 15=1111  we can use this as starting point between 1 to 20. So that we can easily calculate another with the help of only 4 points. Now understand that how can we learn these points forever.
1  =1
1×2+1=3  =11
3×2+1=7  =111
7×2+1=15  =1111
15×2+1=31  =11111 and so on, you can find using this pattern.

Conversion

• Binary to Octal

Binary to Octal
Binary to Octal

(100011)2   =( ? )8

Pair into 3-digits from right to left.

100  011 

Convert into binary digit

100=4  011=3

(100011)2   =( 43 )8

Binary to Octal
Binary to Octal

(1101011.00101)2   =( ? )8

For integer part- Pair into 3-digits from right to left.

 Fractional part- Pair into 3-digits from left to right.

1  101  011  .  001  010

Convert into binary.

1=1  101=5  011=3  001=1  010=2

(1101011.00101)2   =( 153.12 )8

• Binary to Decimal

Binary to Decimal
Binary to Decimal

(11001)2   =( ? )10

Short Trick:- Fill the table from right to left as shown in figure and add all the number which contain 1 only.

Normal Trick:-

(11001)2=1×24+1×23+0x22+0x21+1×20

                =16+8+0+0+1

=25

=( 25 )10

Binary to Decimal
Binary to Decimal

(0.0101)2   =( ? )10

(11001)2=0x2-1+1×2-2+0x2-3+1×2-4

                =0+(1×0.25)+0+(1×0.0625)

=(0.25)+(0.0625)

=( 0.3125 )10

 Binary to Hexadecimal

Binary to Hexadecimal
Binary to Hexadecimal

(100100)2   =( ? )16

For hexadecimal, we pair into 4-digits from right to left.

10  0100

Convert into binary.

10=2  0100=4

(100100)2   =( 24 )16

Binary to Hexadecimal
Binary to Hexadecimal

(1101011.00101)2   =( ? )16

For integer part- Pair into 4-digits from right to left.

 Fractional part- Pair into 4-digits from left to right.

110  1011  0010  1000
Convert into binary.
110=6  1011=B  0010=2  1000=8
(1101011.00101)2   =( 6B.28 )16

◘ Octal Number System

A number system with base 8 containing 8 digits which are (0,1,2,3,4,5,6,7)

Conversion-

Octal to Binary

Octal to Binary
Octal to Binary

(25)8=( ? )2   

Convert octal number into binary.

2=10  5=101

Pair into 3-digits.

010  101

(25)8=( 010101 )2=( 10101 )2  

Octal to Binary
Octal to Binary

(345.12)8=( ? )2

Convert each one into binary.

3=11  4=100  5=101  1=001  2=010

Pair into 3-digit.

011  100 101  001 010

(345.12)8=( 011100101.001010 )2

Octal to Decimal

Octal to Decimal
Octal to Decimal

(45)8=( ? )10

         =4×81+5×80

         =32+5

=( 37 )10

(425.28)8=( ? )10

                 =4×82+2×81+5×80+2×8-1+8×8-2

                =256+21+0.25+0.125

=( 277.373 )10

Octal to Hexadecimal

Octal to Hexadecimal
Octal to Hexadecimal

(213)8=( ? )16
Convert octal to binary with 3-digits

2=010  1=001  3=011

Pair into 4-digits from right to left.

0000 1000 1011

Convert into hexadecimal.

1000=8  1011=B

(213)8=( 8B )16

Octal to Hexadecimal
Octal to Hexadecimal

(525.34)8=( ? )16

Convert into binary with 3-digits.

5=101  2=010  5=101  3=011  4=100

For integer part- Pair into 4-digits from right to left.

 Fractional part- Pair into 4-digits from left to right.

0001  0101  0101  0111 0000

Convert into hexadecimal.

0001=1  0101=5  0101=5  0111=7 0000=0

(525.34)8=( 155.70 )16

◘ Decimal Number System

A number system with base 10 containing 10 digits which are (0,1,2,3,4,5,6,7,8,9)

Conversion-

• Decimal to Binary

Decimal to Binary
Decimal to Binary

(160)10=( ? )2

Continually divide by 2 and keep trace of remainder.

Write all the remainder from MSD to LSD (bottom to top) as shown in figure.

i.e. 10100000

(160)10=( 10100000 )2

Decimal to Binary
Decimal to Binary

(28.125)10=( ? )2

Continually divide integer part by 2 and keep trace of remainder.

Write all the remainder from MSD to LSD (bottom to top) as shown in figure for integer part.

i.e. 11100

Write all the value of integer part from (top to bottom) as shown in figure for fractional part.

i.e. 001

Multiply fractional part by 2 every time

0.125×2    first step will not count

0.250×2    (0) Note down the integer part

0.500×2    (0)  Note down the integer part

1.000        (1)  No need to do more calculation as fractional part becomes 0

(28.125)10=( 11100.001 )2

Not Always

Decimal to Binary
Decimal to Binary

As shown in figure that fractional part is keep repeating. In such case you will only find out up to one pattern.

Decimal to Octal

Decimal to Octal
Decimal to Octal

(85.65)10=( ? )8

Continually divide integer by 8 and keep trace of remainder.

Write all the remainder from MSD to LSD (bottom to top) as shown in figure for integer part.

i.e. 125

Write all the value of integer part from (top to bottom) as shown in figure for fractional part.

i.e. 514

Multiply fractional part by 8 every time

0.65×8    first step will not count

5.20×8    (5) Note down the integer part

1.60×8    (1)  Note down the integer part

4.80        (4)  You can do more steps. But 3-digits place is enough.

(85.65)10=( 125.514 )8

Decimal to Octal
Decimal to Octal

 

(394)10=( ? )8

Continually divide by 8 and keep trace of remainder.

Write all the remainder from MSD to LSD (bottom to top) as shown in figure.

i.e. 6  1  2

(394)10=( 612 )8

• Decimal to Hexadecimal

Decimal to Hexadecimal
Decimal to Hexadecimal
(0.34)10=( ? )16

Write all the value of integer part from (top to bottom) as shown in figure for fractional part.

i.e. 5  7  0  10

Multiply fractional part by 16 every time

0.34×16    first step will not count

5.44×16    (5) Note down the integer part

7.04×16    (7)  Note down the integer part

0.64×16      (0)  Note down the integer part.

10.24×16     (10)You can do more steps. But 4-digits place is enough.

(0.34)10=( 0.570A )16

Decimal to Hexadecimal
Decimal to Hexadecimal

(479)10=( ? )16

Continually divide by 16 and keep trace of remainder.

Write all the remainder from MSD to LSD (bottom to top) as shown in figure.

i.e. 1 13 15

(479)10=( 1DF )16

◘ Hexadecimal Number System

A number system with base 16  containing 16 digits which are (0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F)

Here – (A=10, B=11, C=12, D=13, E=14, F=15)

Hex   Bi.

0      0000

1 0001

2 0010

3 0011

4 0100

5 0101

6 0110

7 0111

8 1000

9 1001

A 1010

B 1011

C 1100

D 1101

E 1110

F 1111

Conversion-

• Hexadecimal to Binary

Hexadecimal to Binary
Hexadecimal to Binary

 

(23)16=( ? )2

Convert into binary.

2=10  3=11

Pair into 4-digits.

0010  1100

(23)16=( 00101100 )2=( 101100 )2

(23.4)16=( ? )2

Convert into binary.

Pair into 4-digits. For integer right to left and for fractional left to right

i.e. 2=0010  3=0011  4=0100

(23.4)16=( 00100011.0100 )2

• Hexadecimal to Octal

Hexadecimal to Octal
Hexadecimal to Octal

(E5)16=( ? )8

Convert into binary with 4-digits.
E=1110  5=1010
Pair into 3-digits from right to left.
11  101  010
Convert into Octal.
(E5)16=( 345 )8

Hexadecimal to Octal
Hexadecimal to Octal

(AF.2B)16=( ? )8

Convert into binary with 4-digits.
A=1010  F=1111  2=0010  B=1011
Pair into 3-digits from right to left for integer part and left to right for fractional part.
010  101  111  010  001 010  110
Convert into Octal.
(E5)16=( 257.126 )8

• Hexadecimal to Decimal

Hexadecimal to Decimal
Hexadecimal to Decimal

(5A9)16=( ? )10

(5A9)16=5×162+Ax161+9×160
               =1280+160+9
(5A9)16=( 1449 )10

Hexadecimal to Decimal
Hexadecimal to Decimal

 

(A69.8)16=( )10

(A69.8)16 =Ax162+6×161+9×160+8×16-1

                 =2560+96+9+0.5

  (A69.8)16=( 2665.5 )10         

 

Thanks for being here,

Written by Anurag Singh

Leave a Comment