Data Representation Tutorial 2
Data Representation Tutorial 2
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.
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)
OR (101011.01)2 ( ? )10
Solution)
positions 5 4 3 2 1 0 -1 -2
= 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
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
OR (412.6)8 ( ? )10
Solution)
positions 2 1 0 -1
= 4 x 82 + 1 x 81 + 2 x 80 + 6 x 8-1
= 256 + 8 + 2 + 6/8
= 266 + 0.75
= ( 266.75 )10
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)
Another Example:-
OR (423.625)10 (?)16
solution)
= ( 1A7 )1
then,
OR (242.2)16 ( ? )10
Solution)
positions 2 1 0 -1
[ Now, we apply Digit * (Base)position + Digit * (Base)position +…….. ], see
= 512 + 64 + 2/16
= 578 + 0.125
= ( 578.125 )10
OR (98AC.E)16 ( ? )10
Solution)
positions 3 2 1 0 -1
= 39084 + 0.875
= ( 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….
(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:
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
(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
So, the answer is (26.24)8 (10110.0101)2 [ discard left most zeros’ while writing answer and
(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)
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
(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
So, the answer is (2E.5C)16 (101110.010111)2 [ discard left most & right most zeros’ while writing
answer ]
(56.27)8 ( ? )16
First, we convert the Octal number to its equivalent binary ( in 3 bits form)……
5 6 . 2 7
Binary = (101110.010111)2
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
(2E.5C)16 ( ? )8
First, we convert the Hexadecimal number to its equivalent binary ( in 4 bits form)……
2 E . 5 C
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.
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.
Example: The following is a message encoded in ASCII code. What is the message?
Ans) Convert each 7 bit code to its hex equivalent from the above ASCII table, so the results are
Now locate the hex values and determine the characters represented by each,
H E L P
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:
Octal 14510.554 ]
Hexadecimal 7BA3.BC4 ]