0% found this document useful (0 votes)
204 views8 pages

Chapter - 6 Data Representation

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 8

COMPUTER AWARENESS

INTERACTIVE EDUCATIONAL FORUM


9811192450, 9811818190, 8586849309
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

1. 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∘=1,21=2,22=4,23=8,24=16,25=32,
26=64, 27=128, 28=256, 29=512,
210=1024, 211=2048

2. 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
3. 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∘=1,81=8,82=64,83=512,84=4096,85=32768

Class notes by Ashish Sharma - 9811192450 Page 1


Data Representation

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

4. 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∘=1,161=16,162=256,
163=4096,164=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

Class notes by Ashish Sharma - 9811192450 Page 2


Data Representation

Conversion between the Number Systems


Different types of conversion between the number systems are discussed below
1. 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 ≠ 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→(?)2

Remainder
2 43 1→LSB
2 21 1
2 10 0
2 5 1
2 2 0
2 1 1→MSB
0

Then, (43)10→(101011)2

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→(?)10
(1101.10)2= 1×23+ 1×22+ 0×21
+1×20+1×2−1+0×2−2
=8+4+0+1 +0. 5+0=13.5
Then, (1101.10)2→(13.5)10

3. 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.

Class notes by Ashish Sharma - 9811192450 Page 3


Data Representation

Example (110110100)2→(?)8
110--6 110--6 100--4
Then, (110110100)2→(664) 8

4. Octal to Binary
Convert every digit of the number from octal to binary in the group of 3 bits.
Example (1034.5)8→(?)2
1—001 0—000 3—011 4—100 5—101
Then, (1034.5)8→(00100001110.101)2

5. 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→(?)16
0011—3 1101—13(D) 0111—7 1011—11(B)
Then, (11110101111011)2→(3D7B)16

6. Hexadecimal to Binary
For this type of conversion, convert each hexadecimal digit to 4 bits binary equivalent.
Example (BA81)16→(?)2

B=11—1011 A=10—1010 8—1000 1—0001


Then, (BA81)16→(1011101010000001)2

7. 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 ≠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→(?)8

Class notes by Ashish Sharma - 9811192450 Page 4


Data Representation

97647 7 LSD
8 12205 5
8 1525 5
8 190 6
8 23 7
8 2 2 MSD
0

Then, (97647)10→(276557)8

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→(?)10
(327.4)8 =3×82+2×81 +7×80+4×8−1
=3×64+2×8+7×1+4/8
=192+16+7+0.5=215.5

Then, (327.4)8→(215.5)10

9. 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 ≠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→(?)16

16 929987 3 LSD
16 58124 12→C
16 3632 0
16 227 3
16 14 14→E MSD
0

Then, (929987)10→(E 30 C 3)16

10. Hexadecimal to Decimal


To convert hexadecimal to decimal following steps are involved
Step 1 Multiply each digit of hexadecimal number with powers of 16.

Class notes by Ashish Sharma - 9811192450 Page 5


Data Representation

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→(?)10 (BC9.8)16
=B×162+C×161+9×160+8×16−1
= 11×256+12×16+9×1+8/16
=2816+192+9+0.5=3017.5
Then, (BC9.8)16→(3017.5)10

11. Octal to Hexadecimal


To convert octal to hexadecimal, following steps are involved
Step 1 Convert the each digit of octal number to binary number
Step 2 Again convert, each binary digit to hexadecimal number
Example (7632)8→(?)16
7—111 6—110 3—011 2—010
(7632)8→(111110011010)2
1111—15(F) 1001—9 1010—10(A)
Then, (7632)8→(F9A)16

12. Octal to Hexadecimal


To convert hexadecimal to octal, following steps are involved
Step 1 Convert the each digit of hexadecimal number to binary number
Step 2 Again convert, each binary digit to octal number
Example (AC2D)16→(?)8
A—1010 C—1100 2—0010 D—1101
(AC2D)16→(1010110000101101)2
001—1, 010—2, 110—6, 000—0, 101—5, 101—5
Then, (AC2D)16→(126055)8

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.

Class notes by Ashish Sharma - 9811192450 Page 6


Data Representation

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 27=128 (from 0 to 127) unique symbols.
ASCII-8 It is a extended version of ASCII-7. It is an 8-bit code, allows 28=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 28=256 combinations of bits.

Types of Logic Gate:


There are three basic gates in any digital system. They are AND, OR and NOT gate. Gate is an
electronic circuit in which we can get Output by one or more but input.

1. AND gate: This gate us also represented by (.) like (A.B). In AND gate, it return True only if both
the conditions or inputs are True otherwise it return False.

Switch A Switch B Switch C


0 0 0
0 1 0
1 0 0
1 1 1

Means,
C=A.B

2. OR gate: This is represented by (+) like (A+B). It return True if any one of the conditions or
inputs is True and if both conditions are False then it returns False. This is circuit of OR gate.

Switch A Switch B Switch C


0 0 0
0 1 1
1 0 1
1 1 1

Means,
C=A+B

Class notes by Ashish Sharma - 9811192450 Page 7


Data Representation

3. Inverter NOT gate: This Gate is also represented by (‘) like A’. In NOT gate, it returns True if
input is false and vice versa. This is circuit of NOT gate.

Switch A Switch B
0 1
1 0

Means,
B=A’
4. NAND Gate :- it is basically the inverse of the AND gate. This gate is designed by combining the
AND and NOT gates. It returns False only if the both conditions or inputs are True otherwise it
returns True.

5. NOR Gate :- It is an inverse of an OR gate. This Gate is designed by combining the OR and NOT
gates. It returns True only if both the conditions or inputs are False otherwise it return False.

6. Exclusive-OR or XOR Gate :- It performs based on the operation of OR Gate. It returns True
only if one conditions is true from both the conditions otherwise it returns False.

The Circuits are as follows :-

NAND gate and NOR gate are called Universal gates because by using these gates any digital circuit
can be constructed.

Important Facts :-

• 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.

Class notes by Ashish Sharma - 9811192450 Page 8

You might also like