[go: up one dir, main page]

0% found this document useful (0 votes)
27 views23 pages

Cs ch2

The document provides an overview of encoding schemes, defining encoding as the process of converting data into binary codes for various purposes such as platform independency and security. It discusses popular encoding standards like ASCII, ISCII, and Unicode, as well as different number systems including decimal, binary, octal, and hexadecimal, along with their conversions. Additionally, it outlines methods for converting between these number systems, including examples for clarity.

Uploaded by

lwdevraj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views23 pages

Cs ch2

The document provides an overview of encoding schemes, defining encoding as the process of converting data into binary codes for various purposes such as platform independency and security. It discusses popular encoding standards like ASCII, ISCII, and Unicode, as well as different number systems including decimal, binary, octal, and hexadecimal, along with their conversions. Additionally, it outlines methods for converting between these number systems, including examples for clarity.

Uploaded by

lwdevraj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 23

Encoding Schemes

What is Encoding?

Process of converting data from one form to


another form is called encoding. In Computer
Science encoding is converting data
(numbers, alphabets, symbols, spaces,
graphics etc.) into binary codes.

Why Encoding?

● Platform Independency
● Internationalization
● Security
● Effective Communication

There are various standard encoding


schemes each part of data is assigned a
unique code. Some of the popular encoding
schemes are mentioned below:

ASCII (American Standard


Code for Information
Interchange)
● Formally began in 1960 and later
promoted by ANSI
● Standard common way to encode and
represent keys of keyboard understood
by every computer.
● It Uses 7-bits to represent any
character.
● It represents (encodes) total 27= 128
characters. (Because of 7-bit
representation)
● It can represent (encode) character set
of English language only.

ASCII Table

Decim Decim Decim


Charact Charact Charact
al al al
er er er
Value Value value

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

ISCII (Indian Standard Code


for Information Interchange)
● Introduced by Bureau of Indian
Standard (BIS) in 1991.
● Standard encoding scheme to
represent Indian Scripts.
● It uses 8-bits to represent characters.
● It represents total 28 = 256 characters.
● It supports 10 different Indian
languages which are: Devanagari,
Punjabi, Bengali, Gujarati, Oriya,
Telugu, Assamese, Kannada,
Malayalam, Tamil and Roman.

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

Decimal Number System


● It is used by humans
● It uses 10 different digits from 0 to 9 to
represent numbers.
● Decimal number system has base 10
● Each place to the left is ten times
greater than the place to its right which
means each place represent a specific
power of the base (10).

Following figure represents the Integer and


fractional part of decimal number 1253.76
alongwith calculation of the decimal number
using positional values-

Positional Value Representation of Decimal


Number
Binary Number System
● It is used by Computer and other
Digital devices.
● It uses two different digits 0 and 1
called as bit to represent any
information
● Binary number system has base 2
● Each place in a binary code represents
a specific power of the base (2).
● Binary Number System is also referred
as Machine Language.

Application of Binary Number System

● Used as Machine Language for


Computer Hardware and other
Electronic Devices.
● Used in ASCII Code and Unicode
● Used in Internet Protocols.
● Used in Image processing, High-end
audio recordings, HD Videos recordings
and data processing and storage.
● Used in Boolean algebra that is a
branch of Mathematics.

Octal Number System


● It is used to represent large and
complex binary codes into concise
manner.
● It uses 8 different digits from 0 to 7 to
represent information.
● Octal Number System has base 8.
● Each place in Octal code represents a
specific power of the base (8).

Applications of Octal Number System

● It is used in register and flip flop of


Computer Motherboards.
● It is used in Mainframe such as UNIVAC,
PDP etc.

Hexadecimal Number System


● It is used to represent large and
complex binary codes into concise
manner.
● It uses 16 different literals which are
0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F to
represent information.
● Hexadecimal Number System has base
16.
● Each place in a Hexadecimal code
represents a specific power of the base
(16).

Applications of Hexadecimal Number


System

● It is used to represent Memory Address


for storage devices used in computers.
● It is used to describe colors in the Web
Pages.
● It is used to represent Media Access
Control (MAC) addresses.
● It is used to display error messages.

Conversion Between
Number System
Decimal to Binary
Conversion
Following are the steps to convert Decimal
Number System to Binary Number System:

● Divide the number by the base value of


the Binary Number System i.e. 2 you
want to convert it from
● Note the remainder
● Keep dividing the quotient by the base
value 2 untill it becomes zero and note
the remainder of each division
● Write all noted remainders in reverse
order (bottom to top)

Example 1: Convert (45)10 to Binary


Number.

Decimal to Binary Conversion


Example 2: Convert (234)10 to Binary
Number

Example of Decimal to Binary Conversion


Decimal to Octal Conversion
Following are the steps to convert Decimal
Number System to Octal Number System:
● Divide the number by the base value of
the Octal Number System i.e. 8 you
want to convert it from
● Note the remainder
● Keep dividing the quotient by the base
value 8 until it becomes zero and note
the remainder of each division
● Write all noted remainders in reverse
order (bottom to top)

Example 1: Convert (186)10 to Octal


Number.

Decimal to Octal Conversion


Example 2: Convert (1683)10 to Octal
Number.

Example of Decimal to Octal Conversion


Decimal to Hexadecimal
Conversion
Following are the steps to convert Decimal
Number System to Hexadecimal Number
System:

● Divide the number by the base value of


the Hexadecimal Number System i.e.
16 you want to convert it from
● Note the remainder
● Keep dividing the quotient by the base
value 16 untill it becomes zero and
note the remainder of each division
● Write all noted remainders in reverse
order (bottom to top)

Example 1: Convert (763)10 to


Hexadecimal Number.

Decimal to Hexadecimal Conversion


Example 2: Convert (2940)10 to
Hexadecimal Number.
Example Decimal to Hexadecimal Conversion
Binary to decimal Conversion
Following are the steps for converting Binary
to Decimal number:

1. Write down binary number


2. Starting from right to left, Write
position number of each bit of given
binary code
3. Find positional value of each bit by
raising its position number as power to
the base 2
4. Multiply each bit with its positional
value and find its corresponding
decimal number
5. Add all these decimal numbers to find
equivalent Decimal number of given
Binary Number.

Example 1: Convert (10011)2 to Decimal


Number

Binary to Decimal Conversion


Example 2: Convert (111100)2 to
Decimal Number

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

Octal to decimal Conversion


Following are the steps for converting octal
to decimal number:

1. Write down octal number


2. Starting from right to left, Write
position number of each digit of given
octal code
3. Find positional value of each bit by
raising its position number as power to
the base 8
4. Multiply each bit with its positional
value and find its corresponding
decimal number
5. Add all these decimal numbers to find
equivalent Decimal number of given
Octal Number.

Example 1: Convert (336)8 to Decimal


Number
Octal to decimal conversion
Example 2: Convert (1325)8 to Decimal
Number

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. Write down Hexadecimal number


2. Starting from right to left, Write
position number of each symbol (digit
or character) of given hexadecimal
code
3. Find positional value of each symbol
(digit or character) by raising its
position number as power to the base
16
4. Multiply each bit with its positional
value and find its corresponding
decimal number
5. Add all these decimal numbers to find
equivalent Decimal number of given
Hexadecimal Number.

Example 1: Convert (7AC)16 to Decimal


Number
Hexadecimal to decimal conversion
Example 2: Convert (1BF6)16 to Decimal
Number

1 x 163 + 11 x 162 + 15 x 161 + 6 x


80
= 4096 + 2816 + 240 +
6
= (7158)10

Binary to Octal Conversion


1. Write Binary Number
2. From right to left, group all the bits of
binary in the set of three
3. Add 0 to the left of the last bit of given
binary number incase set of 3 bit is not
formed
4. Write octal no for each corresponding
set of 3 bits
5. Group these octal digits together to
form equivalent octal number

Example 1: Convert (100110101)2 in


Octal Number
Binary to octal conversion
Example 2: Convert (1011)2 in Octal
Number

1 0 1 1
001 011
13
=(13)8

Octal to Binary Conversion


1. Write octal
number

2. Replace each digit of octal number with


its equivalent set of 3-bit
3. From left to write Arrange and write all
3-bit sets together and form binary
equivalent of given given octal number.

Example 1: convert (745)8 into binary


number
Octal to binary conversion
Binary to Hexadecimal Conversion

1. Write Binary Number


2. From right to left, group all the bits of
binary in the set of four
3. Add 0 to the left of the last bit of given
binary number incase set of 4 bit is not
formed
4. Write hexdecimal no for each
corresponding set of 4 bits
5. Group these hexadecimal digits
together to form equivalent octal
number

Example 1: Convert (1100110101)2 in


hexadecimal Number

Binary to hexadecimal conversion


Example 2: Convert (11101001101)2 in
Hexadecimal no

1 1 1 0 1 0 0 1 1 0
1

0111 0100 1101

7 4 D

= (74D)16
Hexadecimal to binary
conversion
1. Write hexadecimal
number

2. Replace each digit of hexadecimal


number with its equivalent set of 4-bit
3. From left to write Arrange and write all
4-bit sets together and form binary
equivalent of given hexadecimal
number.

Example 1: convert (CA12)16 into binary


number

Hexadecimal to binary conversion


Conversion of Decimal
Number with fractional
part to Binary number
Following are the steps to convert the
fractional part of a decimal number to binary
number system:

● multiply the fractional part by the base


value 2 repeatedly till the fractional
part becomes 0.
● from top to bottom, Write integer part
of the number to get equivlent binary
number.
● If the fractional part does not become 0
in successive multiplication, then stop
after 10 multiplications. In some cases,
fractional part may start repeating,
then stop further calculation.

Example 1: convert (0.625)10 to binary


number.

Decimal with fractional part to binary


conversion
Example 2: convert (.36)10 to binary
number

Example of Decimal number with fractional


part to binary number conversion
Conversion of Decimal Number with
fractional part to Octal number

Following are the steps to convert the


fractional part of a decimal number to Octal
number system:

● multiply the fractional part by the base


value 8 repeatedly till the fractional
part becomes 0.
● from top to bottom, Write integer part
of the number to get equivlent Octal
number.
● If the fractional part does not become 0
in successive multiplication, then stop
after 10 multiplications. In some cases,
fractional part may start repeating,
then stop further calculation.

Example 1: convert (0.175)10 to Octal


number.

Conversion of Decimal no with fractional part


to Octal no
Example 2: convert (0.345)10 to octal
number
Example of Conversion of Decimal no with
fractional part to Octal no
Conversion of Decimal Number with
fractional part to Hexadecimal number

Following are the steps to convert the


fractional part of a decimal number to
Hexadecimal number system:

● multiply the fractional part by the base


value 16 repeatedly till the fractional
part becomes 0.
● from top to bottom, Write integer part
of the number to get equivlent
Hexadecimal number.
● If the fractional part does not become 0
in successive multiplication, then stop
after 10 multiplications. In some cases,
fractional part may start repeating,
then stop further calculation.

Example 1: convert (0.175)10 to


Hexadecimal number.
conversion of decimal no with fractional part
to hexadecimal no
Example 2: convert (0.220)10 to
Hexadecimal number

Example of conversion of decimal no with


fractional part to hexadecimal no
Binary with fractional part to decimal
Conversion

Following are the steps for converting Binary


with Fractional part to Decimal number:

1. Write down binary number


2. Find positional value of each bit by
raising its position number as power to
the base 2
3. Multiply each bit with its positional
value and find its corresponding
decimal number
4. Add all these decimal numbers to find
equivalent Decimal number of given
Binary Number.

Example 1: Convert (10011.11)2 to


Decimal Number
Binary with fractional part to decimal
Conversion
Example 2: Convert (101.01)2 to Decimal
Number

1×22 + 0x21 + 1×20 . 0x2-1 + 1×2-


2
= 4 + 0 + 1 . 0 + 0.25
= (5.25)10

Binary with fractional part to Octal


Conversion

● Write Binary Number


● Group all the bits of binary in the set of
three
● Add 0 to the left of the last bit of
integer part and to the right of the last
bit if the fractional part of given
primary number, incase set of 3 bit is
not formed
● Write octal no for each corresponding
set of 3 bits
● Group these octal digits together to
form equivalent octal number

Example 1: Convert (10101.01101)2 in


Octal Number
Binary with fractional part to Octal
Conversion
Example 2: Convert (1011.10)2 in Octal
Number

1 0 1 1 . 1 0
011 011 . 100
3 3 . 4
=(33.4)8

Binary with fractional part to


Hexadecimal Conversion

1. Write Binary Number


2. Group all the bits of binary in the set of
four
3. Add 0 to the left of the last bit of
integer part and to the right of the last
bit if the fractional part of given binary
number, incase set of 4 bit is not
formed
4. Write hexadecimal no for each
corresponding set of 4 bits
5. Group these hexadecimal digits
together to form equivalent
hexadecimal number

Example 1: Convert (110101.011011)2 in


Octal Number
Binary with fractional part to Hexadecimal
Conversion
Example 2: Convert
(1011111011.1011010)2 in Octal
Number

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

You might also like