Railways Computers Science Data Representation Data Representation

Data Representation

Category : Railways

 

Data Representation

 

Data representation refers those methods which are used internally to represent information stored in a computer. Computers store lots of different types of information as numbers, text, graphics, sounds, etc.

 

Number System

It defines a set of values that is used to represent quantity. Digital computers internally use the binary number system to represent data and perform arithmetic calculations.

 

Types of Number System

The number systems generally used by a computer are as follows

 

Binary Number System

This system is very efficient for computers, but not for humans. It contains only two unique digits 0's and 1's. It is also known as Base 2 system. The binary numbers 0 and 1 are called a bit. The computer always calculates input in binary form. e.g. (10101 )2

Here, 2 represents base of binary number.

 

A list of the first several power of 2 is   

\[2{}^\circ =1,\,{{2}^{1}}=2,\,{{2}^{2}}=4,\,{{2}^{3}}=8,\,{{2}^{4}}=16,\,{{2}^{5}}=32,\]

\[{{2}^{6}}=64,\text{ }{{2}^{7}}=128,\text{ }{{2}^{8}}=256,\text{ }{{2}^{9}}=512,\]

\[{{2}^{10}}=1024,\text{ }{{2}^{11}}=2048~\]     

           

Decimal Number System

It consists of 10 digits from 0 to 9. These digits can be used to represent any numeric value. It is also g known as Base 10 system or positional number system, e.g. \[{{(1275)}_{10,}}\]\[{{(10406)}_{10}}~\]

Octal Number System

It consists of 8 digits from 0 to 7. It is also known as Base 8 system. Each position of the octal number represents a successive power of eight.

 

A list of the first several powers of 8 s   

\[8{}^\circ =1,{{8}^{1}}=8,\,\,{{8}^{2}}=64,{{8}^{3}}=512,{{8}^{4}}=4096,{{8}^{5}}=32768\]

         

Representation of Octal Numbers in Binary

 

Octal

Binary Digits

0

000

1

001

2

010

3

011

4

100

5

101

6

110

7

111

 

Hexadecimal Number System

It provides us with a shorthand method of working with binary numbers. There are 16 unique digits available in this system.

These are 0 to 9 and A to F, where A denotes 10, B denotes 11....... F denotes 15. It is also known as Base 16 system or simply Hex. So, each position of the hexadecimal number represents a successive power of 16.

 

A list of the first several powers of 16 is

\[16{}^\circ =1,{{16}^{1}}=16,{{16}^{2}}=256,\]

\[{{16}^{3}}=4096,{{16}^{4}}=65536~\]

 

Decimal, Binary, Octal and Hexadecimal Equivalents

 

Decimal

Binary

Octal

Hexadecimal

0

0000

0

0

1

0001

1

1

2

0010

2

2

3

0011

3

3

4

0100

4

4

5

0101

5

5

6

0110

6

6

7

0111

7

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

 

Conversion between the Number Systems

Different types of conversion between the number systems are discussed below

 

Decimal to Binary

To convert decimal to binary following steps are involved

Step 1 Divide the given number by 2.

Step 2 Note the quotient and remainder. Remainder should be 0 or 1.

Step 3 If quotient \[\cancel{=}0,\]then again divide the quotient by 2 and back to step 2. If quotient = 0, then stop the process.

Step 4 First remainder is called as Least Significant Bit (LSB) and last remainder is called as Most Significant Bit (MSB).

Step 5 Arrange all remainders from MSB to LSB.

Example   \[{{(43)}_{10}}\to {{(?)}_{2}}\]                   

Remainder

2

43

\[1\to LSB\]

2

21

1

2

10

0

2

5

1

2

2

0

2

1

\[1\to MSB\]

 

0

 

Then,    \[{{(43)}_{10}}\to {{(101011)}_{2}}\]

 

Binary to Decimal

To convert binary to decimal following steps are involved

Step 1 Multiply the all binary digits by powers of 2.

Step 2 The power for integral part will be positive and for fractional part will be negative.

Step 3 Add the all multiplying digits.

Example \[{{(1101.10)}_{2}}\to {{(?)}_{10}}\]

\[{{\left( 1101.10 \right)}_{2}}=\text{ 1}\times {{2}^{3}}+\text{ 1}\times {{2}^{2}}+\text{ 0}\times {{2}^{1}}\]

\[+1\times 2{}^\circ +1\times {{2}^{-1}}+0\times {{2}^{-2}}\]

\[=8+4+0+1\text{ +}0.\text{ }5+0=13.5\]

Then     \[{{(1101.10)}_{2}}\to {{(13.5)}_{10}}\]

 

Binary to Octal

To convert binary to octal following steps are involved

Step 1 Make the group of 3 bits from right to left. If the left most group has less than 3 bits, put in the necessary number of leading zeroes on the left.

Step 2 Now, convert each group to decimal number.

Example \[{{(110110100)}_{2}}\to {{(?)}_{8}}\]

\[\]

Then,      \[{{(110110100)}_{2}}\to {{(664)}_{8}}\]

 

Octal to Binary

Convert every digit of the number from octal to binary in the group of 3 bits.

Example       \[{{(1034.5)}_{8}}\to {{(?)}_{2}}\]

\[\begin{align}

  & \,\,\,1\,\,\,\,\,\,\,\,0\,\,\,\,\,\,\,\,\,3\,\,\,\,\,\,\,\,4\,\,\,\,\,\,\,\,\,\,5 \\

 & \,\,\,\downarrow \,\,\,\,\,\,\,\downarrow \,\,\,\,\,\,\,\,\,\,\downarrow \,\,\,\,\,\,\,\,\downarrow \,\,\,\,\,\,\,\,\,\downarrow  \\

 & \,\,\,\,\,\,\,\,\,\,\,\,\, \\

\end{align}\]

Then,  \[{{(1034.5)}_{8}}\to {{(00100001110.101)}_{2}}\]

Binary to Hexadecimal

To convert a binary number to its hexadecimal equivalent follow these steps

Step 1 Start making the group of 4 bits each from right to left from the given binary number. If the left most group has less than 4 bits, put in the necessary number of leading 0's on the left.

Step 2 Now, each group will be converted to decimal number.

Example  \[{{(11110101111011)}_{2}}\to {{(?)}_{16}}\]

\[\begin{align}

  & \,\,\,\,\,\,\,\, \\

 & \,\, \\

\end{align}\]

Then,  \[{{(11110101111011)}_{2}}\to {{(3\,D7B)}_{16}}\]

 

Hexadecimal to. Binary

For this type of conversion, convert each hexadecimal digit to 4 bits binary equivalent.

Example     \[{{(BA81)}_{16}}\to {{(?)}_{2}}\]

            \[\begin{matrix}

   B=11 & A=10 & 8 & 1  \\

   \downarrow  & \downarrow  & \downarrow  & \downarrow   \\

   1011 & 1010 & 1000 & 0001  \\

\end{matrix}\]

Then,   \[{{(BA81)}_{16}}\to {{(1011101010000001)}_{2}}\]

 

Decimal to Octal

To convert decimal to octal following steps are involved

Step 1 Divide the given number by 8.

Step 2 Note the quotient and remainder. Digits of remainder will be from 0 to 7.

Step 3 If quotient \[\cancel{=}\,\,0,\] then again divide the quotient by 8 and go back to step 2.

Step 4 If quotient = 0, then stop the process.

Step 5 Write each remainder from left to right starting from MSD to LSD.

Example     \[{{(97647)}_{10}}\to {{(?)}_{8}}\]

 

 

 

97647

7  LSD

8

12205

5

8

1525

5

8

190

6

8

23

7

8

2

2  MSD

 

0

 

 

Then,  \[{{(97647)}_{10}}\to {{(276557)}_{8}}\]

 

Octal to Decimal

To convert octal to decimal following steps are involved

Step 1 Multiply each digit of octal number with powers of 8.

Step 2 These powers should be positive for integral part and negative for fractional part.

Step 3 Add the all multiplying digits.

Example \[{{(327.4)}_{8}}\to {{(?)}_{10}}\]

\[{{\left( 327.4 \right)}_{\text{8 }}}=3\times {{8}^{2}}+2\times {{8}^{1}}\text{ +}7\times {{8}^{0}}+4\times {{8}^{-1}}\]

\[=3\times 64+2\times 8+7\times 1+\frac{4}{8}\]8

\[=192+16+7+0.5=215.5\]

Then,   \[{{\left( 327.4 \right)}_{\text{8}}}\to {{\left( 215.5 \right)}_{10}}\]

 

Decimal to Hexadecimal

To convert decimal to hexadecimal, following steps are involves

Step 1 Divide the given number by 16.

Step 2 Note the quotient and remainder. Digits of remainder will be 0 to 9 or A to F.

Step 3 If quotient \[\cancel{=\,\,}0,\] then again divide the quotient by 16 and go back to step 2.

Step 4 If quotient = 0 or less than 16, then stop the process.

Step 5 Write each remainder from left to right starting from MSD to LSD.

Example \[{{(929987)}_{10}}\to {{(?)}_{16}}\]

 

16

929987

3                LSD

16

58124

\[12\to C\]

16

3632

0

16

227

3

16

14

\[14\to E\]    MSD

 

0

 

 

 

 

 

Then,    \[{{\left( 929987 \right)}_{\text{10}}}\to {{\left( E\text{ }30\text{ }C\text{ }3 \right)}_{16}}\]

Hexadecimal to Decimal

To convert hexadecimal to decimal following steps are involved

Step 1 Multiply each digit of hexadecimal number with powers of 16.

Step 2 These powers should be positive for integral part and negative for fractional part.

Step 3 Add the all multiplying digits.

Example \[{{(BC9.8)}_{16}}\to {{(?)}_{10}}\]

            \[{{(BC\,9.8)}_{16}}\]

\[=B\times {{16}^{2}}+C\times {{16}^{1}}+9\times {{16}^{0}}+8\times {{16}^{-1}}\]

\[=\text{ 11}\times 256+12\times 16+9\times 1+\frac{8}{16}\]

\[=2816+192+9+0.5=3017.5\]

Then,   \[{{(BC9.8)}_{16}}\to {{(3017.5)}_{10}}\]

 

Computer Codes

In computer, any characters like alphabet, digit or any special character is represented by collection of 1's and 0's in a unique coded pattern. In computers, the code is made up of fixed size groups of binary positions. The binary coding schemes that are most commonly used are as follows     

      

Binary Coded Decimal (BCD)

It is a number system where four bits are used to represent each decimal digits. BCD is a method of using binary digits to represent the decimal digits (0-9). In BCD system, there is no limit on size of a number.

 

American Standard Code for Information Interchange (ASCII)

These are standard character codes used to store data so that it may be used by other software programs. Basically, ASCII codes are of two types which as follows

ASCII-7 It is a 7-bit standard ASCII code. It allows \[{{2}^{7}}=128\](from 0 to 127) unique symbols.

ASCII-8 It is a extended version of ASCII-7. It is an 8-bit code, allows \[{{2}^{8}}=256\](0 to 255) unique symbols or characters.

 

Extended Binary Coded Decimal Interchange Code (EBCDIC)

In EBCDIC, characters are represented by eight bits. These codes store information which is readable by other computers. It allows \[{{2}^{8}}=256\]combinations of bits.

 

Tit-Bits

  • BCD system was developed by IBM corporation.
  • UNICODE uses 16-bits to represent a symbol in the data. It represents any non-English character, scientific symbol in any language like Chinese, Japanese.
  • Sign bit is the most significant bit, i.e. used to represent the sign of a number that could be either +ve or \[-\]ve.

Other Topics


You need to login to perform this action.
You will be redirected in 3 sec spinner