Data Representation
Data Representation
Number Systems
Understanding A Bit
Memorized List
128 64 32 16 8 4 2 1
Case 1 : Positive Denary Number To Binary
Conversion
128 64 32 16 8 4 2 1
128 64 32 16 8 4 2 1
0 1 0 0 0 0 0 1
128 64 32 16 8 4 2 1
Ans : 0 1 0 0 0 0 0 1
Exam Style Question
0 1 0 0 0 0 0 1
0 1 0 0 0 0 0 1
128 64 32 16 8 4 2 1
0 1 0 0 0 0 0 1
= 64 + 1 (Ans) 65
128 64 32 16 8 4 2 1
Exam Style Question
Hexadecimal
Uses of Hexadecimal
Value Box
A 10
B 11
C 12
D 13
E 14
F 15
Case 3 : Binary Conversion To HexaDecimal
1 1 0 1 1 0 0 1
1 1 0 1 1 0 0 1
1 1 0 1 1 0 0 1
8 4 2 1 8 4 2 1
Step 3 : Add the number with and if the sum is greater than 9
then use Value Box
1 1 0 1 1 0 0 1
8 4 2 1 8 4 2 1
13 9
13 9
Value Box
A 10
B 11
According to value box the value 13
is D so the Final Answer would be
C 12
D 13
E 14
D9
F 15
Ans = F2
Case 4 : Denary To HexaDecimal
128 64 32 16 8 4 2 1
1 1 0 0 0 0 1 1
128 64 32 16 8 4 2 1
1 1 0 0 0 0 1 1
8 4 2 1 8 4 2 1
12 3
C3
Exam Style Question
4 E
0 1 0 0 1 1 1 0
8 4 2 1 8 4 2 1
0 1 0 0 1 1 1 0
Uses of BCD
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
Note : Any number greater than 9 can not be represented as
BCD 4bits
5 4
0 1 0 1 0 1 0 0
0 1 0 1 0 1 0 0
Step 2 : Write down the memorized list for each group and add
0 1 0 1 0 1 0 0
8 4 2 1 8 4 2 1
5 4
Final answer would be 54
0+1 1 0
1+0 1 0
1+1 0 1
1+1+1 1 1
Questions
0 1 1 1 1 1 1 0
1 0 1 1 1 1 1
1 1 0 0 1 1 1 0 1 1 1 1 1
1 1 0 0 1 1 1 1 1 1 1 0 1
Exam Style Question
Ans : 00110010
Ans : 11100001
Binary Magnitude
Binary Representation
Unsigned Binary Numbers : In this all bits contribute to the
magnitude of the number, and there is no concept of
negative numbers.
Two’s Compliment
To represent negative numbers we use a method Known as
Two’s compliment.
128 64 32 16 8 4 2 1
0 1 1 1 1 1 0 1
128 64 32 16 8 4 2 1
0 1 1 1 1 1 0 1
One’s Compliment
Two’s Compliment
0 1 1 1 1 1 0 1
One’s Compliment 1 0 0 0 0 0 1 0
Two’s Compliment 1
1 0 0 0 0 0 1 1
Ans
(i) 193
(ii) C1
(iii) -63
(iv) The first 4 bits would be 12 which is greater than 9 which
is not a valid BCD
Binary Subtraction
10 - 5 = 10 + (-5)
1 0 1 0 1 0 1 0
1 0 1 1 0 1 1 1
1 0 1 1 0 0 0 0 1
Question : State how an overflow can occur when adding two
binary integers
67 01000011
A ?
B ?
[] ?
ASCII
7 bits
128 characters can be represented 0-127
American Standard Code For Information Interchange
Extended ASCII
8 bits
ASCII codes were 7 bit long but then it was extended to have
bit length of 8
256 characters can be represented
UNICODE
Answer :
Only 128 characters can be represented
uses value 0 to 127
Many characters used in other languages can not be
represented
In extended ASCII the characters from 128 to 255 may be
coded differently in different systems.
Answer :
Uses 16, 24, 32 bits
Unicode is designed to be superset of ASCII
Designed so the most characters in other languages can
be represented.
Exam Style Question
128
256
Question 4
Question 19
Answer 2
Answer 4
Answer 6
Answer 7
Answer 10
Answer 12
Answer 15
Answer 18
Answer 20
Answer 21
Answer 23
Answer 24
Answer 26
Answer 30
Answer 31