Chapter - 6 Data Representation
Chapter - 6 Data Representation
Chapter - 6 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.
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.
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
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
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
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
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.
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.
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.
Means,
C=A+B
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.
NAND gate and NOR gate are called Universal gates because by using these gates any digital circuit
can be constructed.
Important Facts :-