Class 11
Data Representation……..tutorial_2
For Computer Science students’
Hopefully, all of you go through the previous uploaded materials. In this material we discuss about conversion of
fractional number from one number system to other, binary addition and character encoding scheme.
Students’, you already learned the number conversions from one number system to other for integer numbers.
Here, I am going to discuss the conversions of numbers with fractional part from one number system to others.
Decimal to Binary conversion:-
Example:- Convert 43.25 to its binary equivalent.
OR (43.25)10 (?)2
solution)
First step: divide the integer part of the number by 2 and note down the remainder then again divide the quotient by 2 not
down the remainder and that process will continue till the quotient become 0.
= ( 101011 )2
then, second step: multiply the fractional part by 2 and note down the integer part of the result then again
multiply the fractional part of the previous result by 2 and note down the integer part of the result and that
process will continue till the fractional part become 0. ( if the fractional part not becoming zero then leave it after 4
or 5 steps and the result will be an approximate value)
fractional part of the above number is .25
So, the answer is (43.25)10 (101011.01)2
Binary to Decimal conversion:-
Example:- Convert (101011.01)2 into its decimal equivalent
OR (101011.01)2 ( ? )10
Solution)
the binary number is 1 0 1 0 1 1 . 0 1 find out the position of
each digit
positions 5 4 3 2 1 0 -1 -2
[ Now, we apply Digit * (Base)position + Digit * (Base)position +…….. ], see
= 1 x 25 + 0 x 24 + 1 x 23 + 0 x 22 + 1 x 21 + 1 x 20 + 0 x 2-1 + 1 x 2-2
= 32 + 0 + 8 + 0 + 2 + 1 + 0 + ¼
= 43 + 0.25
= ( 43.25 )10
So, ( 101011.01 )2 = ( 43.25 )10
Now, In similar way we convert other number systems. Let’s see:
Decimal to Octal Conversion:-
Example:- Convert 266.75 to its binary equivalent.
OR (266.75)10 (?)8
solution)
Divide the number by 8 (Base of the right hand side number system) note down the remainder then again divide the quotient
by 8 note down the remainder (obviously integer division)…… and that process will continue till the quotient become 0.
= ( 412 )8
then, second step: multiply the fractional part by 8 and note down the integer part of the result then again
multiply the fractional part of the previous result by 8 and note down the integer part of the result and that
process will continue till the fractional part become 0. ( if the fractional part not becoming zero then leave it after 4
or 5 steps and the result will be an approximate value)
fractional part of the above number is .75
So, the answer is (266.75)10 (412.6)8
Octal to Decimal Conversion:-
Example:- Convert (412.6)8 into its decimal equivalent
OR (412.6)8 ( ? )10
Solution)
the octal number is 4 1 2 . 6 find out the position of
each digit
positions 2 1 0 -1
[ Now, we apply Digit * (Base)position + Digit * (Base)position +…….. ], see
= 4 x 82 + 1 x 81 + 2 x 80 + 6 x 8-1
= 256 + 8 + 2 + 6/8
= 266 + 0.75
= ( 266.75 )10
So, ( 412.6 )8 = ( 266.75 )10
Decimal to Hexadecimal Conversion:-
Example:- Convert 578 to its hexadecimal equivalent.
OR (578.125)10 (?)16
solution)
Divide the number by 16 (Base of the right hand side number system) note down the remainder then again divide the
quotient by 16 note down the remainder (obviously integer division)…… and that process will continue till the quotient
become 0.
= ( 242 )16
then, second step: multiply the fractional part by 16 and note down the integer part of the result then again
multiply the fractional part of the previous result by 16 and note down the integer part of the result and that
process will continue till the fractional part become 0. ( if the fractional part not becoming zero then leave it after 4
or 5 steps and the result will be an approximate value)
So, the answer ( 578.125 )10 = ( 242.2 )16
Another Example:-
Example:- Convert 423 to its hexadecimal equivalent.
OR (423.625)10 (?)16
solution)
= ( 1A7 )1
then,
So, the answer ( 423.625 )10 = ( 1A7. A )16
Hexadecimal to Decimal Conversion:-
Example:- Convert (242)16 into its decimal equivalent
OR (242.2)16 ( ? )10
Solution)
the hexadecimal number is 2 4 2 . 2 find out the position of
each digit
positions 2 1 0 -1
[ Now, we apply Digit * (Base)position + Digit * (Base)position +…….. ], see
= 2 x 162 + 4 x 161 + 2 x 160 + 2 x 16-1
= 512 + 64 + 2/16
= 578 + 0.125
= ( 578.125 )10
So, ( 242.2 )16 = ( 578.125 )10
Another Example:- Convert (98AC.E)16 into its decimal equivalent
OR (98AC.E)16 ( ? )10
Solution)
the hexadecimal number is 9 8 A C . E find out the position of
each digit
positions 3 2 1 0 -1
[ Now, we apply Digit * (Base)position + Digit * (Base)position +…….. ], see
= 9 x 163 + 8 x 162 + 10 x 161 + 12 x 160 + 14 x 16-1
= 36864 + 2048 + 160 + 12 + 14/16
= 39084 + 0.875
= ( 39084.875 )10
So, ( 98AC.E )16 = ( 39084.875 )10
NOW, there is an easy way to convert from Binary to Octal and Binary to
Hexadecimal………..which I already discussed in my previous material….
so, here we can apply that method:
Binary to Octal conversion:-
(10110.0101)2 ( ? )8
First you grouped the digits of the integer part into groups of three bits starting from left side from the dot ( . )
position.(if there is less than three digits in the left most group then insert zeros )
Then you grouped the digits of the fractional part to the right side from the dot (.) position (if there is less than
three digits in the right most group then insert zeros)
see the following:
group in the following group in the following
direction direction
two zero’s
0 1 0 1 1 0 . 0 1 0 1 0 0
inserted here
0 inserted as
there are two
digits in left
most group
now you can write the decimal equivalent of each group i.e.
0 1 0 1 1 0 . 0 1 0 1 0 0
2 6 2 4
So, the answer (10110.0101)2 ( 26.24 )8
Now, Octal to Binary conversion:-
(26.24)8 ( ? )2
Here, we represent each digit of the octal number in its binary equivalent of 3 bits form…..see….
2 6 . 2 4
010 110 010 100
So, the answer is (26.24)8 (10110.0101)2 [ discard left most zeros’ while writing answer and
right most zeros also]
Now, Binary to Hexadecimal conversion:-
(101110.010111)2 ( ? )16
First you grouped the digits of the integer part into groups of four bits starting from left side from the dot ( . )
position.(if there is less than four digits in the left most group then insert zeros )
Then you grouped the digits of the fractional part to the right side from the dot (.) position (if there is less than
four digits in the right most group then insert zeros)
see the following:
group in the following group in the following
direction direction
0 0 1 0 1 1 1 0 . 0 1 0 1 1 1 0 0
two 0’s inserted two zero’s
as there are inserted here
two digits in
left most group
now you can write the decimal equivalent of each group i.e.
0 0 1 0 1 1 1 0 . 0 1 0 1 1 1 0 0
2 E 5 C
So, the answer (101110.010111)2 ( 2E.5C )8
Hexadecimal to Binary conversion:-
(2E.5C)16 ( ? )2
Here, we represent each digit of the hexadecimal number in its binary equivalent of 4 bits form…..see….
2 E . 5 C
0010 1110 0101 1100
So, the answer is (2E.5C)16 (101110.010111)2 [ discard left most & right most zeros’ while writing
answer ]
Now, Octal to Hexadecimal Conversion:-
(56.27)8 ( ? )16
First, we convert the Octal number to its equivalent binary ( in 3 bits form)……
5 6 . 2 7
101 110 010 111
Binary = (101110.010111)2
now, grouped the digits into groups of four bits as follows:
0 0 1 0 1 1 1 0 . 0 1 0 1 1 1 0 0
2 E 5 C
So, the answer is (56.27)8 ( 2E.5C )16
Now, Hexadecimal to Octal Conversion:-
(2E.5C)16 ( ? )8
First, we convert the Hexadecimal number to its equivalent binary ( in 4 bits form)……
2 E . 5 C
0010 1110 0101 1100
now, grouped the digits into groups of three bits as follows:
0 0 1 0 1 1 1 0 . 0 1 0 1 1 1 0 0 [ discard left most and right
discard 2
5 6 7 most zeros ]
extra zero’s
from left discard
extra zero’s
from right
Binary Addition:
Example: Example:
Example:
Example:
Characters / string representation scheme:-
In addition to numerical data, a computer should recognize codes that represent letters of the alphabet,
punctuation marks and other special characters as well as numbers. These codes are called alphanumeric codes.
A complete alphanumeric code would include the 26 lowercase letters, 26 uppercase letters, 10 numeric digits, 7
punctuation marks and other characters also like + - * / % etc. i.e. all the various characters are found on a
standard keyboard.
To represent those characters some encoding schemes are used in computer.
Common encoding schemes are:
ASCII: -
The most widely used alphanumeric code, the American Standard Code for information Interchange (ASCII) is a
7-bit code, so it has 27 = 128 possible code groups.
Table: some ASCII values
Do not need to remember all ASCII codes……..just remember the following decimal equivalent of following
characters as follows ( as you already learned conversion from decimal to binary):
Characters Decimal equivalent
A - Z 65 - 90
a - z 97 - 122
0 - 9 48 - 57
Example: The following is a message encoded in ASCII code. What is the message?
10010000 1000101 1001100 1010000
Ans) Convert each 7 bit code to its hex equivalent from the above ASCII table, so the results are
10010000 48 1000101 45 1001100 4C 1010000 50
Now locate the hex values and determine the characters represented by each,
H E L P
so, the answer is HELP
There are extended ASCII that uses 8 bits to represent various characters, so it can represent more characters as
28 = 256 possible code groups as opposed to ASCII (7-bit).
ISCII Code:-
With the advent of computerization considerable work has been undertaken to facilitate the use of Indian
languages on computers. In, 1991, Bureau of Indian Standards adopted the Indian Standard Code for
Information Interchange (ISCII). This is an 8 – bit code capable of coding 28 = 256 characters including ASCII
characters and Indian scripts also. Thus it is also called Indian Scripts Code for Information Interchange. It
supports different scripts like Devanagari, Gurumukhi, Gujarati, Oriya, Bengali, Assamese, Telugu, Kannada,
Malayalam and Tamil script.
Unicode:-
There are many encoding schemes available that represent different characters of different languages. As world
is becoming a global village thanks to modern technology, a need was being felt for an encoding scheme that
represent all the known languages characters through one standard encoding scheme. Unicode is the answer.
Unicode is developed as Universal Character Set – to define all the characters needed to writing the majority of
known languages in use on computers in one place. It is an superset of all other character sets that have been
encoded.
It is 16 – bits code, capable to represent 216 i.e. 65536 characters. The Unicode Standard provides a unique
number for every character, no matter what platform, device, application or language.
Solve the following and check with the answer provided below:
1) Convert (1948.B6)16 to Binary and Octal equivalents. [ answer: Binary 0001100101001000.10110110
Octal 14510.554 ]
2) Convert (75643.5704)8 to Hexadecimal and Binary equivalents.
[ answer: Binary 111101110100011.101111000100
Hexadecimal 7BA3.BC4 ]
3) Convert (FACE)16 to Binary [ answer Binary 1111101011001110 ]
4) Convert (1010100.011)2 to Decimal [answer Decimal 84.325 ]
5) Add the following Binary numbers:-
(i) 11100 + 11010
(ii) 01010111 + 00110101
(iii) 110101 + 101111
(iv) 10110 + 1101
(v) 110111.110 + 11011101.010
Read the whole materials carefully…..
and try to solve all given tasks
For any problem message or call me