0% found this document useful (0 votes)
1K views11 pages

I PUC CS Chapter 2

Uploaded by

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

I PUC CS Chapter 2

Uploaded by

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

CHAPTER – 2

ENCODING SCHEMES AND NUMBER SYSTEM

We have already learnt that computer understands only binary language of 0s and 1s.
Therefore, when a key on the keyboard is pressed, it is internally mapped to a unique code,
which is further converted to binary.

Input / Internally mapped Converted to


Character to a unique code Binary

Encoding: The mechanism of converting data into an equivalent cipher using specific code is
called encoding. (Cipher = Encryption)

Q. Example letter ‘A’ is coded as ‘65’, is it same for all the keyboards irrespective of
their make?

Yes, it is same for all the keyboards. This has been possible because of standard encoding
schemes where each letter, numeral and symbol is encoded or assigned a unique code.

Some of the well-known encoding schemes:

1) American Standard Code for Information Interchange (ASCII)


 Developed in the early 1960s
 To avoid different ways of representing keys of the keyboard in different
systems
 Initially ASCII used 7 bits to represent characters. Therefore, total number of
different characters on the English keyboard that can be encoded by 7-bit 1
ASCII code is 27 = 128.
 ASCII is able to encode character set of English language only.

PJC | Chethan M B Arehalli I [email protected]


Example of writing word DATA in binary value:

2) Indian Script Code for Information Interchange (ISCII)


 Developed during 1980s
 To facilitate the use of Indian languages on computers, ISCII was developed in
India.
 It is an 8-bit code representation for Indian languages which means it can
represent 28 =256 characters.
 It retains all 128 ASCII codes and uses rest of the codes (128) for additional
Indian language character set, where (160–255) for the ‘aksharas’ of the
language.

3) UNICODE: Universal Character Encoding Standard.


 Unicode is a character encoding standard that has been developed to
incorporate all the characters of every written language of the world, to avoid
confusions between coding systems of different languages.
 UNICODE provides a unique number for every character, irrespective of
device (server, desktop, mobile), operating system (Linux, Windows, iOS) or
software application (Browsers, applications etc.)
 Commonly used UNICODE encodings are UTF-8, UTF-16 and UTF-32.
(Unicode Transformation Format)

PJC | Chethan M B Arehalli I [email protected]


Number System:

 A number system is a method to represent (write) numbers.


 Each key (representing character, special symbol, function keys, etc.) of the keyboard
is internally mapped to an ASCII code or UNICODE etc. following an encoding
scheme.
 This encoded value is further converted to its equivalent binary representation so that
the computer can understand it.
 Literals: a set of unique characters of every number systems
 Ex: 0 & 1 in Binary number system and 0,1,2,3,4,5,6 & 7 in octal number
system
 Radix (base of the number system): The count of the literals in the number system
 Ex: 2 for binary system, 8 for Octal system etc.

Positional number system:

 Number systems are also called positional number system because the value of each
symbol (i.e., digit and alphabet) in a number depends upon its position within the
number. 3
 Number may also have a fractional part similar to decimal numbers used by us.
 Each symbol in a number has a positional value, which is computed using its position
value and the base value of the number system.

PJC | Chethan M B Arehalli I [email protected]


Positional value representation in decimal number system for 123.45:

1) Decimal Number System:


 It is known as base-10 (Radix 10) system with 10 digits (0 to 9) is used; the
decimal number system is used in our day-to-day life.

2) Binary Number System


 The ICs (Integrated Circuits) in a computer are made up of a large number of
transistors which are activated by the electronic signals (low/high) they
receive.
 The ON/ high and OFF/low state of a transistor is represented using the two
digits 1 and 0, respectively.

PJC | Chethan M B Arehalli I [email protected]


3) Octal Number System
 Octal number system is called base-8 system (Radix 8) as it has total eight
digits (0-7), and positional value is expressed in powers of 8.
 Three binary digits (8=23) are sufficient to represent any octal digit.
 Examples of octal numbers are (234.09)8 , (56)8 etc.

4) Hexadecimal Number System


 It consists of 16 unique symbols (0–9, A–F), and is called base 16 system
(Radix 16).
 In hexadecimal system, each alphanumeric digit is represented as a group of 4
binary digits because 4 bits (24 =16) are sufficient to represent 16
alphanumeric symbols.
 Examples of Hexadecimal numbers are (23𝐵. 04)16 & (1𝐶3)16 .

Applications of Hexadecimal Number System:

1. Main memory consists of unique addresses, typically 16-bit or 32-bit in size. Binary 5
representation of these addresses can be complex (Example: 1100000011110001), so
hexadecimal or octal notation is used for simplicity and manageability by
programmers.

PJC | Chethan M B Arehalli I [email protected]


2. Hexadecimal numbers are used to represent colors on webpages, where each color is
composed of three primary components: red, green, and blue (RGB). With a palette of
16 million colors available, each color requires 24 bits (8 bits each for red, green, and
blue).
 Hexadecimal notation is preferred over binary for compact representation and
easier recall. For instance, the color red in a 24-bit binary format
(11111111,00000000,00000000) is simplified to (FF,00,00) in hexadecimal.

Conversion between Number Systems:

 Decimal number system is most commonly used by humans, but digital


systems understand binary numbers;
 Whereas Octal and hexadecimal number systems are used to simplify the
binary representation for us to understand.

1) Conversion from Decimal to other Number Systems


To convert a decimal number to any other number system (binary, octal or
hexadecimal), use the steps given below.
 Step 1: Divide the given number by the base value (b) of the number system in
which it is to be converted
 Step 2: Note the remainder
 Step 3: Keep on dividing the quotient by the base value and note the remainder
till the quotient is zero
 Step 4: Write the noted remainders in the reverse order (from bottom to top)

(A) Decimal to Binary Conversion

 Since the base value of binary system is 2, the decimal number is repeatedly divided
by 2 following the steps given in above till the quotient is 0.
 Record the remainder after each division and finally write the remainders in reverse
order in which they are computed.

Conversion of a decimal number “65” to its equivalent binary number:

PJC | Chethan M B Arehalli I [email protected]


(B) Decimal to Octal Conversion

 Since the base value of octal is 8, the decimal number is repeatedly divided by 8 to
obtain its equivalent octal number.

(C) Decimal to Hexadecimal Conversion

 Since the base value of hexadecimal is 16, the decimal number is repeatedly divided
by 16 to obtain its equivalent hexadecimal number.

Conversion of number 65 from decimal system to Hexa decimal

PJC | Chethan M B Arehalli I [email protected]


Conversion from other Number Systems to Decimal Number System:

 Step 1: Write the position number for each alphanumeric symbol in the given number
 Step 2: Get positional value for each symbol by raising its position number to the base
value b symbol in the given number
 Step 3: Multiply each digit with the respective positional value to get a decimal value
 Step 4: Add all these decimal values to get the equivalent decimal number

A) Binary Number to Decimal Number


 Since binary number system has base 2, the positional values are computed in
terms of powers of 2.

(B) Octal Number to Decimal Number

(C) Hexadecimal Number to Decimal Number

Conversion from Binary Number to Octal/ Hexadecimal Number and Vice-Versa:

A) Binary Number to Octal Number


 A binary number is converted to octal number by making groups of 3 bits

PJC | Chethan M B Arehalli I [email protected]


(B) Octal Number to Binary Number

(C) Binary Number to Hexadecimal Number

 A binary number is converted to hexadecimal number by making groups of 4


bits

(D) Hexadecimal Number to Binary Number

Conversion of a Number with Fractional Part:

(A) Decimal Number with Fractional Part to another Number System

PJC | Chethan M B Arehalli I [email protected]


(B) Non-decimal Number with Fractional Part to Decimal Number System

10

PJC | Chethan M B Arehalli I [email protected]


(C) Fractional Binary Number to Octal or Hexadecimal Number

***********************************************

11

PJC | Chethan M B Arehalli I [email protected]

You might also like