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
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.
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
To facilitate the use of Indian languages on computers, ISCII was developed in India during the mid-1980s.
To resolve incompatibility issues between various localized encoding schemes, UNICODE was developed to incorporate all characters of every written language in the world.
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). |
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}$$
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.
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) |
To convert a decimal number to binary, octal, or hexadecimal, use the successive division method:
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)₂
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}$$
Example 2.9: Convert $(10101100)_2$ to Octal
Grouping into 3s: 010 101 100 → $2$ $5$ $4$ → $(254)_8$
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)₂