Data Representation and Number System-1
Data Representation and Number System-1
com
3 Number Conversions
Page 1 of 26
Unit I: Computer Systems and Organization Visit to website: learnpython4cbse.com
29 Encoding Schemes
32 3) UNICODE
33 MORE EXAMPLES……………
Page 2 of 26
Unit I: Computer Systems and Organization Visit to website: learnpython4cbse.com
NUMBER SYSTEM
A number system is defined as a system of writing to express numbers.
Every number system has a set of unique characters or literals.
The count of these literals is called the radix or base of the number
system.
Number may also have a fractional part similar to decimal numbers
used by us.
Four different number systems:
MSD LSD
Left most digit will be MSD (most significant digit and right most digit
will be LSD (least significant digit)
Page 3 of 26
Unit I: Computer Systems and Organization Visit to website: learnpython4cbse.com
For example: ( 1 0 1 1 0 1 )2
1 0 1 1 0 1
MSD LSD
( 1 0 1 1 0 1 ) 2 = 1 x 2 5 + 0 x 2 4 + 1 x 2 3 + 1 x 2 2 + 0 x 2 1 + 1 x 20
= 1 x 32 + 0 x 16 + 1 x 8 + 1 x 4 + 0 x 2 + 1 x 1
= 32 + 0 + 8 + 4 + 0 + 1 = (45)10
Page 4 of 26
Unit I: Computer Systems and Organization Visit to website: learnpython4cbse.com
Where,
MSD LSD
( 321 )8 = 3 x 82 + 2 x 81 + 1 x 80
= 192 + 16 + 1 = (209)10
Page 5 of 26
Unit I: Computer Systems and Organization Visit to website: learnpython4cbse.com
MSD LSD
Number Conversions
At times, you need to covert a number from one number system to
another.
Distinct methods have been defined for conversion between each pair
of number systems.
Page 7 of 26
Unit I: Computer Systems and Organization Visit to website: learnpython4cbse.com
2 1 0
0 1 MSB
Answer: (65)10 to (1000001)2
Step 4: Collect the remainders
from bottom to top to get the
binary equivalent.
Page 8 of 26
Unit I: Computer Systems and Organization Visit to website: learnpython4cbse.com
Page 9 of 26
Unit I: Computer Systems and Organization Visit to website: learnpython4cbse.com
Step 1: Write the position number for each alphanumeric symbol in the
given number
Step 2: Get positional value for each symbol by raising its position
number to the base value b symbol in the given number
Step 3: Multiply each digit with the respective positional value to get a
decimal value
Step 4: Add all these decimal values to get the equivalent decimal
number
Page 10 of 26
Unit I: Computer Systems and Organization Visit to website: learnpython4cbse.com
Position Number 2 1 0
Positional Value 82 81 80
= 3 x 82 + 2 x 81 + 01x 80
Decimal Number = 192 + 16+ 1 = (209)10
Position Number 3 2 1 0
Page 11 of 26
Unit I: Computer Systems and Organization Visit to website: learnpython4cbse.com
Page 12 of 26
Unit I: Computer Systems and Organization Visit to website: learnpython4cbse.com
Write down the three bit number below each octal digit as shown below:
Octal Number -> 3 7 5
↓ ↓ ↓
Binary Number -> 011 111 101
Page 13 of 26
Unit I: Computer Systems and Organization Visit to website: learnpython4cbse.com
For this conversion make the group of four digits from right to left before
decimal & left to right after decimal then assign the specific Hexadecimal
value.
Divide into groups for 3 digits and convert each group to octal digit
Binary Number -> 0001 1010 1000 . 1010 1000
↓ ↓ ↓ ↓ ↓
Octal Number -> 1 A 8 . A 8
Page 14 of 26
Unit I: Computer Systems and Organization Visit to website: learnpython4cbse.com
Step 2: Divide the getting binary number from step 1 into groups for 3
digits and convert each group to octal digit
Binary Number -> 101 001 000 010
↓ ↓ ↓ ↓
Octal Number -> 5 1 0 2
Hence, the Octal equivalent of the given hexadecimal number is (5102)8
Page 15 of 26
Unit I: Computer Systems and Organization Visit to website: learnpython4cbse.com
Step 2: Divide the getting binary number from step 1 into groups for 4
digits and convert each group to hexadecimal digit
Binary Number -> 0001 0111 0010
↓ ↓ ↓
Hex Number -> 1 7 2
Page 16 of 26
Unit I: Computer Systems and Organization Visit to website: learnpython4cbse.com
Number System
Repeatedly multiply the fractional part by the base value b till the
fractional part becomes 0.
Use integer part from top to bottom to get equivalent number in that
number system.
i) Convert Fractional Decimal to Binary
Example: Convert (0.675)10 to binary.
Integer part
0.675 × 2 = 1.350 1
0.350 × 2 = 0.700 0
0.700 × 2 = 1.400 1
0.400 × 2 = 0.800 0
0.800 × 2 = 1.600 1
0.600 × 2 = 1.200 1
0.200 × 2 = 0.400 0
Since the fractional part (.400) is the repeating value in the calculation,
the multiplication is stopped. Write the integer part from top to bottom
to get binary number for the fractional part.
Therefore, (0.675)10= (0.1010110)2
Page 17 of 26
Unit I: Computer Systems and Organization Visit to website: learnpython4cbse.com
Integer part
0.625 × 2 = 1.250 1
0.250 × 2 = 0.500 0
0.500 × 2 = 1.000 1
Hence,
(45.625)10 = (101101. 101) 2
Page 18 of 26
Unit I: Computer Systems and Organization Visit to website: learnpython4cbse.com
Page 19 of 26
Unit I: Computer Systems and Organization Visit to website: learnpython4cbse.com
Digit 1 0 0 1 0 1 . 1 0 1
0×2-2 +1×2-3
= 32 + 0 + 0 + 4 + 0 + 1 + 0.5 + 0 + 0.125
= 37 + 0.625
Page 20 of 26
Unit I: Computer Systems and Organization Visit to website: learnpython4cbse.com
Page 21 of 26
Unit I: Computer Systems and Organization Visit to website: learnpython4cbse.com
Encoding Schemes:
Encoding scheme maps text into the codes that facilitate
communication among computers. Lets understand with example -
“When the key ‘A’ is pressed, it is internally mapped to a decimal
value 65 (code value), which is then converted to its equivalent
binary value for the computer to understand.
Similarly, when we press alphabet ‘ अ ’ on Hindi keyboard,
internally it is mapped to a hexadecimal value 0905, whose binary
equivalent is 0000100100000101.”
Textual data is encoded using ASCII, ISCII or Unicode.
Page 22 of 26
Unit I: Computer Systems and Organization Visit to website: learnpython4cbse.com
Example: Encode the word FACE and convert the encoded value into
binary values which can be understood by a computer.
3) UNICODE
MORE EXAMPLES……………
Page 24 of 26
Unit I: Computer Systems and Organization Visit to website: learnpython4cbse.com
Page 25 of 26
Unit I: Computer Systems and Organization Visit to website: learnpython4cbse.com
Page 26 of 26