Chapter 2
Encoding Schemes and Number System
Introduction to Encoding System:
Have you ever thought how the keys on the computer keyboard that are in human recognizable form
are interpreted by the computer system? This section briefly discusses text interpretation by the
computer.
What is encoding?
Encoding is the process of converting data or information into a specific format or code that can
be stored, transmitted, or understood by a computer.
In other words, the mechanism of converting data into an equivalent cipher using specific code
is called encoding.
Example: When the key ‘A’ is pressed (Figure 2.1), it is internally mapped to a decimal value 65 (code
value), which is then converted to its equivalent binary value for the computer to understand
Similarly, when we press alphabet ‘अ’ on hindi keyboard, internally it is mapped to a hexadecimal value
0905, whose binary equivalent is 0000100100000101.
Different Encoding Schemes:
1) American Standard Code for Information Interchange (ASCII)
In the early 1960s, computers had no way of communicating with each other due to different ways of
representing keys of the keyboard. Hence, the need for a common standard was realised to overcome
this shortcoming. Thus, encoding scheme ASCII was developed for standardising the character
representation. ASCII is still the most commonly used coding scheme.
Initially ASCII used 7 bits to represent characters. Recall that there are only 2 binary digits` (0 or 1).
Therefore, total number of different characters on the English keyboard that can be encoded by 7-bit
ASCII code is 27 = 128. Table 2.1 shows some printable characters for ASCII code. But ASCII is able to
encode character set of English language only.
The American Standard Code for Information Interchange (ASCII) is a character encoding
standard used to represent text in computers and other devices that use text. It was developed
in the early 1960s and has become one of the most widely used encoding systems.
Character Set:
ASCII defines a set of 128 characters, which includes:
Uppercase letters (A-Z)
Lowercase letters (a-z)
Digits (0-9)
Punctuation marks (e.g., ., !, ?, etc.)
Control characters (e.g., carriage return, line feed, etc.)
Binary Representation:
Each ASCII character is represented by a 7-bit binary number, allowing for 128 unique
combinations (from 0000000 to 1111111 in binary).
For example:
The letter 'A' is represented as 65 in decimal (or 01000001 in binary).
The letter 'a' is represented as 97 in decimal (or 01100001 in binary)
ASCII code for some printable characters
Example: Encode the word DATA and convert the encoded value into binary values which can be
understood by a computer.
ASCII value of D is 68 and its equivalent 7-bit binary code = 1000100
ASCII value of A is 65 and its equivalent 7-bit binary code = 1000001
ASCII value of T is 84 and its equivalent 7-bit binary code = 1010100
ASCII value of A is 65 and its equivalent 7-bit binary code = 1000001
Replace each alphabet in DATA with its ASCII code value to get its equivalent ASCII code and with 7-bit
binary code to get its equivalent binary number as shown in Table 2
ASCII and Binary values for word DATA
2) Indian Script Code for Information Interchange (ISCII)
Indian Script Code for Information Interchange (ISCII) is an 8-bit encoding standard specifically
developed for Indian languages during the mid-1980s. It was created to facilitate the digital processing
and interchange of text in multiple Indian scripts.
ISCII was designed to standardize the encoding of Indian scripts across different digital platforms and
devices, enabling consistent representation, storage, and transmission of text in multiple Indian
languages.
Key features of ISCII:
8-bit Encoding: Each character is represented using 8 bits, allowing a total of 256 possible
characters.
Backward Compatibility: It retains all 128 characters of the ASCII standard, ensuring
compatibility with systems that use ASCII.
Indian Script Characters: The additional 128 codes (from 128 to 255) are reserved for Indian
language characters, such as vowels, consonants, and complex aksharas (syllabic units).
Range for Indian Characters: These are typically assigned in the upper range, especially codes
160–255.
Representation: It includes characters for various Indian scripts like Devanagari, Bengali, Tamil,
Telugu, Kannada, and others.
3) UNICODE:
Unicode is a universal character encoding standard that assigns a unique number, called a code point, to
every character across the world's writing systems. Its main goal is to enable consistent encoding,
representation, and handling of text in multiple languages and scripts on different devices and
platforms.
Key Components of Unicode
Code Points:
Each character in Unicode is assigned a unique identifier known as a code point, typically represented in
hexadecimal format preceded by "U+".
For example:
The letter 'A' has the code point U+0041.
The emoji (grinning face) has the code point U+1F600.
Encoding Forms:
Unicode can be implemented using different encoding forms:
UTF-8: A variable-length encoding that uses one to four bytes per character. It is backward-
compatible with ASCII, meaning the first 128 characters are identical to ASCII.
UTF-16: Uses one or two 16-bit code units for each character.
UTF-32: Uses a fixed length of four bytes for each character.
Character Sets:
Unicode encompasses a wide range of scripts, including Latin, Cyrillic, Arabic, Chinese, and many others,
along with symbols, emojis, and special characters.
Unicode table for the Devanagari script
Number System
Introduction:
A number system is a method of representing numbers using a consistent set of symbols and rules. It
allows us to perform arithmetic operations and express numerical values in various forms. The most
common number systems include the decimal, binary, octal, and hexadecimal systems.
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.
Computation of decimal number using its positional value
Types of Number Systems in Computing:
1. Decimal Number System (Base 10):
Number system with base value 10 is termed as Decimal number system. It uses 10 digits i.e. 0-9 for
the creation of numbers. The decimal number system is used in our day-to-day life. A number is
presented by its two values Symbol value (any digit from 0 to 9) and positional value (in terms of base
value).
Explanation: In the decimal system, each position in a number represents a power of 10.
The rightmost digit is the "ones" place (10⁰).
The next digit to the left is the "tens" place (10¹).
Then the "hundreds" place (10²), and so on.
Example: The number 456 in decimal can be broken down as:
45610 = (4×102) + (5×101) + (6×100)
= (4×100) + (5×10) + (6×1)
= 400+50+6
=456
2. Binary Number System (Base 2):
Number System with base value 2 is termed as Binary number system. It uses 2 digits i.e. 0 and 1 for
the creation of numbers. The numbers formed using these two digits are termed as Binary Numbers.
Binary number system is very useful in electronic devices and computer systems because it can be
easily performed using just two states “ON” and “OFF” i.e. 0 and 1.
Decimal Numbers 0-9 are represented in binary as: 0, 1, 10, 11, 100, 101, 110, 111, 1000, and 1001
Explanation: Each position in a binary number represents a power of 2.
The rightmost digit is the 2⁰ place.
The next digit to the left is the 2¹ place.
Then the 2² place, and so on.
Example: The binary number 11012 can be converted to decimal as:
11012= (1×23) + (1×22) + (0×21) + (1×20)
= (1×8) + (1×4) + (0×2) + (1×1)
=8+4+0+1
=1310
Binary value for (0–9) digits of decimal number system
3. Octal Number System (Base 8):
In the octal number system, the base is 8 and it uses numbers from 0 to 7 to represent numbers. Octal
numbers are commonly used in computer applications. Converting an octal number to decimal is the
same as decimal conversion and is explained below using an example.
Explanation: Each position in an octal number represents a power of 8.
Example: The octal number 2738 can be converted to decimal as:
2738= (2×82) + (7×81) + (3×80)
= (2×64) + (7×8) + (3×1)
=128+56+3
=18710
Decimal and binary equivalent of octal numbers 0 – 7
4. Hexadecimal Number System (Base 16):
Number System with base value 16 is termed as Hexadecimal Number System. It uses 16 digits for the
creation of its numbers. Digits from 0-9 are taken like the digits in the decimal number system but the
digits from 10-15 are represented as A-F i.e. 10 is represented as A, 11 as B, 12 as C, 13 as D, 14 as E,
and 15 as F. Hexadecimal Numbers are useful for handling memory address locations.
Explanation: Each position in a hexadecimal number represents a power of 16.
Example: The hexadecimal number A5F16 can be converted to decimal as:
A5F16= (A×162) + (5×161) + (F×160)
= (10×256) + (5×16) + (15×1)
=2560+80+15
=265510
Decimal and binary equivalent of hexadecimal numbers 0–9, A–F
Applications of Hexadecimal Number System
To define memory locations - Hexadecimals can represent every byte as two hexadecimal digits
only compared to eight digits when using binary.
To define colours on web pages - Each primary colour - Red, Green and Blue is characterized by
two hexadecimal digits. The format being used is #RRGGBB. RR stands for Red, GG stands for
Green and BB stands for Blue.
To represent Media Access Control (MAC) addresses - MAC address consist of 12-digits
hexadecimal number.
It is also used to display error messages.
Conversions of given number to different number system
After knowing about different number systems, it is easy to know about conversions of numbers to
other number system which is in need. The decimal numbers are familiar and used in our day-to-day
needs. The binary numbers are used by electronic devices and octal and hexa-decimal numbers are used
to understand larger binary numbers by making shorter representation.
Conversion of Decimal Number to Binary Number
Step 1: Divide the given decimal number by 2.
Step 2: Note the quotient and remainder
Step 3: Repeat above two steps until quotient becomes zero.
Step 4: Write all noted remainders together from bottom to top.
Example 1: Convert 9 (10) to binary number. Example 2: Convert 169 (10) to binary number.
2 9 2 169
2 4-1 2 84-1
2 2-0 2 42-0
1-0 2 21-0
2 10-1
9(10) = 1001(2) 2 5-0
2 2-1
1-
Conversion of Decimal Number to Octal Number
Step 1: Divide the given decimal number by 8.
Step 2: Note the quotient and remainder.
Step 3: Repeat above two steps until quotient becomes zero.
Step 4: Write all noted remainders together from bottom to top.
Example 1: Convert 156 (10) to octal number
8 156
8 19-4
2-3
156(10) = 234(8)
Verification:
We can check this by converting the octal number back to decimal:
234 (octal) = (2 × 8²) + (3 × 8¹) + (4 × 8⁰)
= (2 × 64) + (3 × 8) + (4 × 1)
= 128 + 24 + 4
= 156 (decimal)
The conversion is correct.
Conversion of Decimal Number to Hexa-Decimal Number
Step 1: Divide the given decimal number by 16,
Step 2: Note the quotient and remainder.
Step 3: Repeat above two steps until quotient becomes zero.
Step 4: Write all noted remainders together from bottom to top.
Example 1: Convert 78(10) to hexadecimal number.
16 78
16 4-14
0-4
78(10) = 4E(16)
Conversion of Binary Number to Decimal Number
Step 1: Multiply each bit of binary number with its positional weight.
Step 2: Add all product terms.
Example 1: Convert 10110(2) to decimal number.
Positions 24 23 22 21 20
Digits 1 0 1 1 0
Calculate the value of each position:
= 1 × 2⁴ + 0 × 2³ + 1 × 2² + 1 × 2¹+ 0 × 2⁰
= 1 × 16 + 0 × 8 + 1 × 4 + 1 × 2 + 0 × 1
= 16 + 0 + 4 + 2+ 0
= 22(10)
Example 2: Convert (100101.101)2 into decimal.
Therefore, (100101.101)2 = (37.625)10
Conversion of Octal Number to Decimal Number
Step 1: Multiply each digit of an octal number with its positional weight.
Step 2: Add all product terms.
Example 1: Convert 27 to decimal number.
Positions 81 80
Digits 2 7
Conversion of Hexa-Decimal Number to Decimal Number
Step 1: Multiply each digit of hexadecimal number by its positional weight.
Step 2: Add all product terms.
Example 1: Convert 1C (16) to decimal number
Positions 161 160
Digits 1 C