Cs ch2
Cs ch2
What is Encoding?
Why Encoding?
● Platform Independency
● Internationalization
● Security
● Effective Communication
ASCII Table
Space 32 @ 64 , 96
! 33 A 65 a 97
“ 34 B 66 b 98
# 35 C 67 c 99
$ 36 D 68 d 100
% 37 E 69 e 101
& 38 F 70 f 102
‘ 39 G 71 g 103
( 40 H 72 h 104
) 41 I 73 i 105
UNICODE
● It has been developed to represent all
the characters of every written
language of world.
● It can represent near about 1,000,000
characters
● It may be 8-bit, 16-bit or 32-bit
● It is superset of ASCII
● UTF-8, UTF-16 and UTF-32 are some
common Unicode encodings among
which UTF-8 is most commonly used.
Number System
● Number system is mathematical way to
represent numbers using literals such
as digits, characters or symbols.
● It is also known as Positional Number
System because value of each literal
(digit, character or symbol) in a
number depends upon its position
within number.
● There are different number system and
all have their own set of unique literals.
● The count of literals of number system
is called Base or Radix.
● The value of each literal in a number is
calculated using-
● The literal itself
● Position of the literal
● Base of the number system
● There are four number systems used in
the context computer-
● Decimal Number System
● Binary Number System
● Octal Number System
● Hexadecimal Number System
Conversion Between
Number System
Decimal to Binary
Conversion
Following are the steps to convert Decimal
Number System to Binary Number System:
1 x 25 + 1 x 2 4 + 1 x 2 3 + 1 x 2 2 +
0 x 21 + 0 x 2 0
= 32 + 16 + 8 + 4
+ 0 + 0
= (61)10
1 x 83 + 3 x 8 2 + 2 x 8 1 + 5 x 8 0
= 512 + 192 + 16 + 5
= (725)10
Hexadecimal to decimal
Conversion
Following are the steps for converting
Hexadecimal to Decimal number:
1 0 1 1
001 011
13
=(13)8
1 1 1 0 1 0 0 1 1 0
1
7 4 D
= (74D)16
Hexadecimal to binary
conversion
1. Write hexadecimal
number
1 0 1 1 . 1 0
011 011 . 100
3 3 . 4
=(33.4)8
1 0 1 1 1 1 1 0 1 1 . 1 0 1
1 0 1 0
0010 1111 1011 . 1011 0100
2 F B . B 4
=(2FB.B4)16