Computer Science: Class 11 — Chapter 2: Encoding Schemes and Number System

2.1 Introduction to Encoding Schemes

Computers internally understand only the 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. The mechanism of converting data into an equivalent cipher using a specific code is called encoding .

Example 2.1: Keyboard Input Mapping

When the key ‘A’ is pressed, it is internally mapped to a decimal value 65 (code value), which is then converted to its equivalent binary value 01000001 for the computer to understand. Similarly, when we press the alphabet ‘अ’ on a Hindi keyboard, it is internally mapped to a hexadecimal value 0905, whose binary equivalent is 0000100100000101.


Socio-Technical Analysis & Core Systemic Impact: Standardized encoding ensures that different hardware manufacturers and software applications interpret user keystrokes identically, preventing data corruption and enabling global localization of software systems.

Technical Profile: Character Encoding Schemes

  • Architecture Layer / Tier: Presentation Layer / Data Representation Tier
  • Operational Mechanics & Syntax: Maps alphanumeric characters and symbols to unique numeric codes (decimal/hexadecimal) which are then represented as binary digits (bits).
  • System Trade-offs & Failures: Limited character sets (e.g., ASCII) fail to represent multilingual \text, leading to the development of larger, more resource-intensive standards like UNICODE.
2.1.1 American Standard Code for Information Interchange (ASCII)

In the early 1960s, computers had no standard way of communicating with each other due to different character representations. ASCII was developed to overcome this shortcoming and is still widely used.

  • Initially used 7 bits to represent characters.
  • Total number of different characters that can be encoded is $2^7 = 128$.
  • ASCII is able to encode the character set of the English language only.

Table 2.1: ASCII code for some printable characters

Character Decimal Value Character Decimal Value Character Decimal 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

Example 2.2: Encoding the word "DATA"

  • ASCII value of D is 68 (Binary: 1000100)
  • ASCII value of A is 65 (Binary: 1000001)
  • ASCII value of T is 84 (Binary: 1010100)
  • ASCII value of A is 65 (Binary: 1000001)

Resulting Binary Stream: 1000100 1000001 1010100 1000001

2.1.2 Indian Script Code for Information Interchange (ISCII)

To facilitate the use of Indian languages on computers, ISCII was developed in India during the mid-1980s.

  • It is an 8-bit code representation, allowing it to represent $2^8 = 256$ characters.
  • It retains all 128 ASCII codes and uses the remaining 128 codes for additional Indian language character sets.
  • Additional codes in the upper region (160–255) are assigned for the ‘aksharas’ of the languages.
2.1.3 UNICODE

To resolve incompatibility issues between various localized encoding schemes, UNICODE was developed to incorporate all characters of every written language in the world.

  • Provides a unique number for every character, irrespective of device, operating system, or software application.
  • Commonly used UNICODE encodings are UTF-8 , UTF-16 , and UTF-32 .
  • It is a superset of ASCII; values 0–127 represent the same characters as in ASCII.
2.2 Number Systems

A number system is a method to represent (write) numbers. Every number system has a set of unique characters or literals. The count of these literals is called the radix or base of the number system.

Core Computer Science Concept Technical Definition / Operational State Structural Parameters & Specifications Computational Function & System Purpose
Decimal Base-10 positional system used in daily life. Digits: 0–9. Base: 10. Human-readable numerical representation and calculations.
Binary Base-2 system representing electronic states. Digits: 0, 1. Base: 2. Machine-level execution, logic gates, and memory storage.
Octal Base-8 system used for compact binary representation. Digits: 0–7. Base: 8. Simplifies long binary streams (1 octal digit = 3 bits).
Hexadecimal Base-16 system used for memory addressing and color codes. Digits: 0–9, A–F. Base: 16. Compact representation of binary data (1 hex digit = 4 bits).
2.2.1 Decimal Number System

The value of each digit in a decimal number depends on its position. The positional value of the integer part increases from right to left by powers of 10, starting at $10^0$. The fractional part decreases from left to right by negative powers of 10, starting at $10^{-1}$.

Example: Positional expansion of 123.45

$$1 \times 10^2 + 2 \times 10^1 + 3 \times 10^0 + 4 \times 10^{-1} + 5 \times 10^{-2} = (123.45)_{10}$$

2.2.2 Binary Number System

Computers use Integrated Circuits (ICs) made of transistors that act as switches. The ON (high voltage) state is represented by 1, and the OFF (low voltage) state is represented by 0.

2.2.5 Applications of Hexadecimal Number System
  • Memory Addressing: Simplifies 16-bit or 32-bit binary memory addresses (e.g., binary 1100000011110001 maps to hex C0F1).
  • Web Colors (RGB): Colors are represented using 24 bits (8 bits each for Red, Green, and Blue). Hexadecimal notation (e.g., #FF0000 for Red) is used for compact representation.

Table 2.7: Color codes in decimal, binary, and hexadecimal

Color Name Decimal (R,G,B) Binary Representation Hexadecimal
Black (0,0,0) (00000000,00000000,00000000) (00,00,00)
White (255,255,255) (11111111,11111111,11111111) (FF,FF,FF)
Yellow (255,255,0) (11111111,11111111,00000000) (FF,FF,00)
Grey (128,128,128) (10000000,10000000,10000000) (80,80,80)
2.3 Conversion Between Number Systems
2.3.1 Conversion from Decimal to other Number Systems

To convert a decimal number to binary, octal, or hexadecimal, use the successive division method:

  1. Divide the decimal number by the target base value $b$ (2, 8, or 16).
  2. Record the remainder.
  3. Divide the quotient by $b$ again, recording the remainder, until the quotient is 0.
  4. Write the remainders in reverse order (from bottom to top).

Example 2.3: Convert $(122)_{10}$ to Binary

  
    122 / 2 = 61  Remainder: 0
    61 / 2 = 30  Remainder: 1
    30 / 2 = 15  Remainder: 0
    15 / 2 = 7   Remainder: 1
    7 / 2 = 3   Remainder: 1
    3 / 2 = 1   Remainder: 1
    1 / 2 = 0   Remainder: 1
    Result: (1111010)₂
  
2.3.2 Conversion from other Number Systems to Decimal

Multiply each digit of the number by its positional value (base raised to the power of its position index) and sum the products.

Example 2.8: Convert $(3A5)_{16}$ to Decimal

$$3 \times 16^2 + 10 \times 16^1 + 5 \times 16^0 = 768 + 160 + 5 = (933)_{10}$$

2.3.3 Binary to Octal/Hexadecimal and Vice-Versa
  • Binary to Octal: Group binary bits into sets of 3 from right to left. Replace each group with its octal equivalent.
  • Binary to Hexadecimal: Group binary bits into sets of 4 from right to left. Replace each group with its hexadecimal equivalent.

Example 2.9: Convert $(10101100)_2$ to Octal

Grouping into 3s: 010 101 100 → $2$ $5$ $4$ → $(254)_8$

2.3.4 Conversion of Numbers with Fractional Parts

To convert a decimal fraction to another base, multiply the fractional part repeatedly by the target base $b$. Record the integer part of the product. Repeat with the remaining fractional part until it becomes 0 or starts repeating.

Example 2.13: Convert $(0.25)_{10}$ to Binary

  
    0.25 * 2 = 0.50  Integer part: 0
    0.50 * 2 = 1.00  Integer part: 1
    Result: (0.01)₂