CBSE Class 11 Computer Science Chapter 2 — Encoding Schemes and Number Systems
Number systems and encoding schemes are fundamental to how computers represent and process data. Every piece of information inside a computer — text, numbers, images, sound — is ultimately stored as binary digits (0s and 1s). This chapter teaches you the four major number systems (decimal, binary, octal, and hexadecimal), how to convert between them, and the encoding schemes (ASCII, ISCII, Unicode) that allow computers to represent characters and text. Mastering these conversions is essential for your exams and for understanding how computers work at the lowest level.
Key Definitions
| Term | Definition |
|---|---|
| Number System | A systematic way of representing numbers using a specific base (radix) and set of digits. |
| Decimal | Base-10 number system using digits 0-9. The number system humans use every day. |
| Binary | Base-2 number system using digits 0 and 1. The number system computers use internally. |
| Octal | Base-8 number system using digits 0-7. A shorthand representation of binary. |
| Hexadecimal | Base-16 number system using digits 0-9 and letters A-F. A compact representation of binary. |
| Radix (Base) | The number of unique digits used in a number system. Decimal has radix 10, binary has radix 2. |
| Bit | A single binary digit (0 or 1). The smallest unit of data in computing. |
| Byte | A group of 8 bits. Can represent 256 different values (2 to the power 8). |
| Nibble | A group of 4 bits. One hexadecimal digit corresponds to one nibble. |
| MSB | Most Significant Bit — the leftmost bit in a binary number with the highest place value. |
| LSB | Least Significant Bit — the rightmost bit in a binary number with the lowest place value. |
| Encoding | The process of converting data into a specific format for storage or transmission. |
| ASCII | American Standard Code for Information Interchange — 7-bit character encoding for English. |
| ISCII | Indian Script Code for Information Interchange — 8-bit encoding for Indian languages. |
| Unicode | A universal character encoding standard that supports all world scripts and languages. |
| UTF-8 | Variable-length Unicode encoding using 1-4 bytes. Backward compatible with ASCII. |
| UTF-16 | Variable-length Unicode encoding using 2 or 4 bytes. Used by Windows and Java internally. |
| UTF-32 | Fixed-length Unicode encoding using exactly 4 bytes per character. Simple but memory-heavy. |
Detailed Concepts
Number Systems
A number system defines how numbers are represented using a set of digits and a base. Each position in a number has a place value that is a power of the base.
Decimal Number System (Base 10)
The decimal system is the number system we use in everyday life. It uses 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. Each digit position represents a power of 10.
Example: The decimal number 425 means:
- 4 x 10^2 = 4 x 100 = 400
- 2 x 10^1 = 2 x 10 = 20
- 5 x 10^0 = 5 x 1 = 5
- Total = 400 + 20 + 5 = 425
Place values from right to left: ones (10^0), tens (10^1), hundreds (10^2), thousands (10^3), and so on.
Binary Number System (Base 2)
The binary system uses only 2 digits: 0 and 1. It is the fundamental number system for all digital computers because electronic circuits have two states — ON (1) and OFF (0). Each digit position represents a power of 2.
Example: The binary number 1101 means:
- 1 x 2^3 = 1 x 8 = 8
- 1 x 2^2 = 1 x 4 = 4
- 0 x 2^1 = 0 x 2 = 0
- 1 x 2^0 = 1 x 1 = 1
- Total = 8 + 4 + 0 + 1 = 13 (decimal)
Place values from right to left: 1, 2, 4, 8, 16, 32, 64, 128...
Octal Number System (Base 8)
The octal system uses 8 digits: 0, 1, 2, 3, 4, 5, 6, 7. Each digit position represents a power of 8. Octal is useful as a compact way to represent binary numbers because one octal digit equals exactly three binary digits.
Example: The octal number 72 means:
- 7 x 8^1 = 7 x 8 = 56
- 2 x 8^0 = 2 x 1 = 2
- Total = 56 + 2 = 58 (decimal)
Hexadecimal Number System (Base 16)
The hexadecimal system uses 16 symbols: 0-9 and A, B, C, D, E, F (where A=10, B=11, C=12, D=13, E=14, F=15). Each digit position represents a power of 16. Hexadecimal is widely used in computing because one hex digit equals exactly four binary digits (one nibble), making it a very compact representation.
Example: The hexadecimal number 2F means:
- 2 x 16^1 = 2 x 16 = 32
- F(15) x 16^0 = 15 x 1 = 15
- Total = 32 + 15 = 47 (decimal)
Conversion Methods with Worked Examples
1. Decimal to Binary
Method: Repeated division by 2
Divide the decimal number by 2 repeatedly. Record the remainders. Read the remainders from bottom to top (reverse order).
Example: Convert 25 (decimal) to binary
| Division | Quotient | Remainder |
|---|---|---|
| 25 / 2 | 12 | 1 |
| 12 / 2 | 6 | 0 |
| 6 / 2 | 3 | 0 |
| 3 / 2 | 1 | 1 |
| 1 / 2 | 0 | 1 |
Read remainders from bottom to top: 11001
So, 25 (decimal) = 11001 (binary)
Example: Convert 13 (decimal) to binary
| Division | Quotient | Remainder |
|---|---|---|
| 13 / 2 | 6 | 1 |
| 6 / 2 | 3 | 0 |
| 3 / 2 | 1 | 1 |
| 1 / 2 | 0 | 1 |
Read remainders from bottom to top: 1101
So, 13 (decimal) = 1101 (binary)
For fractional parts: Multiply the fractional part by 2 repeatedly. Record the integer parts (0 or 1) from top to bottom.
Example: Convert 0.625 (decimal) to binary
| Multiplication | Result | Integer Part |
|---|---|---|
| 0.625 x 2 | 1.25 | 1 |
| 0.25 x 2 | 0.50 | 0 |
| 0.50 x 2 | 1.00 | 1 |
Read integer parts from top to bottom: 0.101
So, 0.625 (decimal) = 0.101 (binary)
2. Binary to Decimal
Method: Positional weight (sum of products)
Multiply each binary digit by its place value (power of 2) and add them up.
Example: Convert 1101 (binary) to decimal
1 x 2^3 = 8 1 x 2^2 = 4 0 x 2^1 = 0 1 x 2^0 = 1
Total = 8 + 4 + 0 + 1 = 13
So, 1101 (binary) = 13 (decimal)
Example: Convert 10110 (binary) to decimal
1 x 2^4 = 16 0 x 2^3 = 0 1 x 2^2 = 4 1 x 2^1 = 2 0 x 2^0 = 0
Total = 16 + 0 + 4 + 2 + 0 = 22
So, 10110 (binary) = 22 (decimal)
3. Decimal to Octal
Method: Repeated division by 8
Divide the decimal number by 8 repeatedly. Record the remainders. Read remainders from bottom to top.
Example: Convert 156 (decimal) to octal
| Division | Quotient | Remainder |
|---|---|---|
| 156 / 8 | 19 | 4 |
| 19 / 8 | 2 | 3 |
| 2 / 8 | 0 | 2 |
Read remainders from bottom to top: 234
So, 156 (decimal) = 234 (octal)
Example: Convert 100 (decimal) to octal
| Division | Quotient | Remainder |
|---|---|---|
| 100 / 8 | 12 | 4 |
| 12 / 8 | 1 | 4 |
| 1 / 8 | 0 | 1 |
Read remainders from bottom to top: 144
So, 100 (decimal) = 144 (octal)
4. Octal to Decimal
Method: Positional weight (sum of products)
Multiply each octal digit by its place value (power of 8) and add them up.
Example: Convert 234 (octal) to decimal
2 x 8^2 = 2 x 64 = 128 3 x 8^1 = 3 x 8 = 24 4 x 8^0 = 4 x 1 = 4
Total = 128 + 24 + 4 = 156
So, 234 (octal) = 156 (decimal)
Example: Convert 17 (octal) to decimal
1 x 8^1 = 8 7 x 8^0 = 7
Total = 8 + 7 = 15
So, 17 (octal) = 15 (decimal)
5. Decimal to Hexadecimal
Method: Repeated division by 16
Divide the decimal number by 16 repeatedly. Record the remainders (use A-F for 10-15). Read remainders from bottom to top.
Example: Convert 255 (decimal) to hexadecimal
| Division | Quotient | Remainder |
|---|---|---|
| 255 / 16 | 15 | 15 (F) |
| 15 / 16 | 0 | 15 (F) |
Read remainders from bottom to top: FF
So, 255 (decimal) = FF (hexadecimal)
Example: Convert 756 (decimal) to hexadecimal
| Division | Quotient | Remainder |
|---|---|---|
| 756 / 16 | 47 | 4 |
| 47 / 16 | 2 | 15 (F) |
| 2 / 16 | 0 | 2 |
Read remainders from bottom to top: 2F4
So, 756 (decimal) = 2F4 (hexadecimal)
6. Hexadecimal to Decimal
Method: Positional weight (sum of products)
Multiply each hex digit by its place value (power of 16) and add them up. Remember A=10, B=11, C=12, D=13, E=14, F=15.
Example: Convert 2F4 (hexadecimal) to decimal
2 x 16^2 = 2 x 256 = 512 F(15) x 16^1 = 15 x 16 = 240 4 x 16^0 = 4 x 1 = 4
Total = 512 + 240 + 4 = 756
So, 2F4 (hex) = 756 (decimal)
Example: Convert 1A3 (hexadecimal) to decimal
1 x 16^2 = 1 x 256 = 256 A(10) x 16^1 = 10 x 16 = 160 3 x 16^0 = 3 x 1 = 3
Total = 256 + 160 + 3 = 419
So, 1A3 (hex) = 419 (decimal)
7. Binary to Octal
Method: Group into sets of 3 bits from right to left
Each group of 3 binary digits corresponds to one octal digit. Pad with leading zeros on the left if needed.
| Binary | Octal |
|---|---|
| 000 | 0 |
| 001 | 1 |
| 010 | 2 |
| 011 | 3 |
| 100 | 4 |
| 101 | 5 |
| 110 | 6 |
| 111 | 7 |
Example: Convert 110101 (binary) to octal
Step 2: Convert each group: 110 = 6, 101 = 5 Step 3: Combine: 65
| Step 1: Group from right in sets of 3: 110 | 101 |
|---|
So, 110101 (binary) = 65 (octal)
Example: Convert 10111001 (binary) to octal
Step 2: Convert each group: 010 = 2, 111 = 7, 001 = 1 Step 3: Combine: 271
| Step 1: Group from right: 010 | 111 | 001 (added leading zero) |
|---|
So, 10111001 (binary) = 271 (octal)
8. Octal to Binary
Method: Replace each octal digit with its 3-bit binary equivalent
This is the reverse of the binary-to-octal conversion.
Example: Convert 65 (octal) to binary
6 = 110, 5 = 101
Combine: 110101
So, 65 (octal) = 110101 (binary)
Example: Convert 271 (octal) to binary
2 = 010, 7 = 111, 1 = 001
Combine: 010111001 = 10111001 (removing leading zero)
So, 271 (octal) = 10111001 (binary)
9. Binary to Hexadecimal
Method: Group into sets of 4 bits from right to left
Each group of 4 binary digits corresponds to one hexadecimal digit. Pad with leading zeros if needed.
| Binary | Hex |
|---|---|
| 0000 | 0 |
| 0001 | 1 |
| 0010 | 2 |
| 0011 | 3 |
| 0100 | 4 |
| 0101 | 5 |
| 0110 | 6 |
| 0111 | 7 |
| 1000 | 8 |
| 1001 | 9 |
| 1010 | A |
| 1011 | B |
| 1100 | C |
| 1101 | D |
| 1110 | E |
| 1111 | F |
Example: Convert 11010111 (binary) to hexadecimal
Step 2: Convert each group: 1101 = D, 0111 = 7 Step 3: Combine: D7
| Step 1: Group from right in sets of 4: 1101 | 0111 |
|---|
So, 11010111 (binary) = D7 (hexadecimal)
Example: Convert 101011 (binary) to hexadecimal
Step 2: Convert each group: 0010 = 2, 1011 = B Step 3: Combine: 2B
| Step 1: Group from right: 0010 | 1011 (added leading zeros) |
|---|
So, 101011 (binary) = 2B (hexadecimal)
10. Hexadecimal to Binary
Method: Replace each hex digit with its 4-bit binary equivalent
Example: Convert D7 (hexadecimal) to binary
D = 1101, 7 = 0111
Combine: 11010111
So, D7 (hex) = 11010111 (binary)
Example: Convert 2B (hexadecimal) to binary
2 = 0010, B = 1011
Combine: 00101011 = 101011 (removing leading zeros)
So, 2B (hex) = 101011 (binary)
Encoding Schemes
Encoding schemes define how characters (letters, digits, symbols) are represented as binary codes inside the computer. Without encoding, a computer would not know that the binary pattern 01000001 represents the letter 'A'.
ASCII (American Standard Code for Information Interchange)
- Developed in 1963 by the American Standards Association.
- Uses 7 bits to represent each character.
- Can represent 128 characters (2^7 = 128).
- Includes: 0-9 (48-57), A-Z (65-90), a-z (97-122), special characters, and control characters.
- Extended ASCII uses 8 bits (256 characters) to add accented characters and box-drawing symbols.
- Limited to English language only.
Important ASCII values to remember:
- Space = 32
- '0' to '9' = 48 to 57
- 'A' to 'Z' = 65 to 90
- 'a' to 'z' = 97 to 122
Example: The word "Hi" in ASCII:
- H = 72 (decimal) = 1001000 (binary)
- i = 105 (decimal) = 1101001 (binary)
- "Hi" stored as: 1001000 1101001
ISCII (Indian Script Code for Information Interchange)
- Developed in the 1980s by the Department of Electronics (now MeitY), Government of India.
- Uses 8 bits to represent each character.
- Can represent 256 characters (2^8 = 256).
- Supports major Indian scripts: Devanagari (Hindi, Marathi, Sanskrit), Bengali, Gujarati, Kannada, Malayalam, Oriya, Tamil, Telugu, and Punjabi (Gurmukhi).
- The first 128 codes match ASCII, making it backward compatible with English.
- ISCII was a significant step toward Indian language computing but has been largely replaced by Unicode.
- Not widely used today but historically important for Indian language support on computers.
Unicode
- Developed by the Unicode Consortium, first version released in 1991.
- A universal character encoding standard designed to support every writing system in the world.
- As of Unicode 15.0, it supports over 149,000 characters across 161 scripts.
- Covers: Latin, Cyrillic, Arabic, Devanagari, Tamil, Chinese, Japanese, Korean, Emoji, mathematical symbols, and many more.
- Unicode itself is a character set — it assigns a unique number (code point) to each character. The encoding formats are UTF-8, UTF-16, and UTF-32.
UTF-8 (Unicode Transformation Format - 8-bit):
- Variable-length encoding: 1 byte for ASCII characters, 2 bytes for Latin extended, 3 bytes for most other scripts, 4 bytes for rare characters and emoji.
- Fully backward compatible with ASCII — the first 128 code points match ASCII exactly.
- Most popular encoding on the web (used by over 98% of websites).
- Efficient for English-heavy text (1 byte per character) but can use up to 4 bytes for other scripts.
UTF-16:
- Variable-length encoding: uses 2 bytes for most common characters (Basic Multilingual Plane), 4 bytes for rare characters.
- Used internally by Windows, Java, and .NET frameworks.
- Less efficient than UTF-8 for English text (2 bytes minimum per character) but more efficient for Asian scripts.
UTF-32:
- Fixed-length encoding: uses exactly 4 bytes (32 bits) for every character.
- Simplest to process (no variable-length complexity) but uses the most memory.
- Rarely used for storage or transmission due to memory inefficiency.
- Used internally in some applications where constant-time character access is needed.
Encoding Schemes — Comparison Table
| Feature | ASCII | ISCII | Unicode (UTF-8) |
|---|---|---|---|
| Bits per character | 7 | 8 | 8-32 (variable) |
| Max characters | 128 | 256 | 1,114,112 (code points) |
| Languages supported | English only | Indian scripts | All world scripts |
| Year introduced | 1963 | 1980s | 1991 |
| Backward compatible with ASCII | Yes | Yes (first 128) | Yes (first 128) |
| Current usage | Legacy/limited | Rare | Standard for web and computing |
| Storage efficiency | Very efficient for English | Moderate | Efficient for English, moderate for others |
| Indian language support | No | Yes | Yes |
Common Mistakes Students Make
1. Reading remainders in the wrong order: When converting decimal to another base, students read remainders top-to-bottom instead of bottom-to-top. Always read remainders in reverse order — the last remainder is the most significant digit.
| 2. Forgetting to pad groups with zeros: When converting binary to octal (groups of 3) or binary to hex (groups of 4), students forget to add leading zeros to make complete groups. Example: 101 binary to octal must be padded as 101 (already complete), but 1011 must be padded as 001 | 011. |
|---|
3. Confusing hex digits A-F with decimal values: A=10, B=11, C=12, D=13, E=14, F=15. Students sometimes treat A as 1 or B as 2. Memorize these mappings.
4. Mixing up conversion methods: Using the positional weight method when you should use repeated division, or vice versa. Rule: to convert FROM decimal, use repeated division. To convert TO decimal, use positional weights.
5. Confusing UTF-8, UTF-16, and UTF-32: These are all encodings of the same Unicode standard, not different character sets. The difference is how many bytes each character uses. UTF-8 is variable (1-4 bytes), UTF-16 is variable (2-4 bytes), UTF-32 is fixed (4 bytes).
6. Treating ASCII and Extended ASCII as the same: Standard ASCII is 7-bit (128 characters). Extended ASCII is 8-bit (256 characters). When a question says ASCII without qualification, it means the 7-bit version.
7. Forgetting the fractional conversion method: For decimal fractions to binary, the method is repeated multiplication by 2 (not division). The integer parts are read from top to bottom (not reversed).
8. Ignoring the base subscript: Always write the base as a subscript to avoid confusion. 10 in binary is 2 in decimal. 10 in octal is 8 in decimal. 10 in hex is 16 in decimal. Without the subscript, 10 is ambiguous.
Exam Tips
1. Show all steps in conversions: Examiners award step marks. Write each division step, each remainder, and the final answer. Never write just the final answer for conversion questions.
2. Draw the division table: For decimal-to-other-base conversions, draw the division table with columns for Division, Quotient, and Remainder. This is clear and earns full marks.
3. Verify your answer: After converting, convert back to check. If you converted 25 decimal to 11001 binary, convert 11001 back to decimal (1x16 + 1x8 + 0x4 + 0x2 + 1x1 = 25). If it matches, your answer is correct.
4. Memorize the key ASCII values: Space=32, '0'=48, 'A'=65, 'a'=97. From these, you can calculate any other ASCII value. For example, 'C' = 65 + 2 = 67, 'd' = 97 + 3 = 100.
5. Remember the grouping shortcuts: Binary to octal = groups of 3 bits. Binary to hex = groups of 4 bits. This works because 8 = 2^3 and 16 = 2^4. These are the fastest conversion methods and do not require going through decimal.
6. Write the base subscript: Always write (10), (2), (8), or (16) next to your answers. Without it, the examiner cannot tell which base you are working in, and you may lose marks.
7. Practice mixed conversions: Exam questions often ask for multi-step conversions like "convert octal 27 to hexadecimal." Do this by first converting to binary (27 octal = 010 111 binary = 10111 binary), then group into 4 bits (0001 0111), then convert to hex (17). Practice these chains.
8. Know why Unicode replaced ASCII and ISCII: Examiners love asking "Why was Unicode needed?" Answer: ASCII supports only English (128 characters), ISCII supports only Indian scripts, but Unicode supports all world languages in a single unified standard, making global communication possible.
Quick Revision Notes
- Decimal (base 10): digits 0-9, everyday number system.
- Binary (base 2): digits 0-1, the language of computers.
- Octal (base 8): digits 0-7, shorthand for binary (3 binary digits = 1 octal digit).
- Hexadecimal (base 16): digits 0-9, A-F, compact binary representation (4 binary digits = 1 hex digit).
- Decimal to any base: Repeated division by the base, read remainders bottom-to-top.
- Any base to decimal: Positional weight method — multiply each digit by base^position, sum all.
- Binary to octal: Group into sets of 3 bits from right, replace each group with octal digit.
- Octal to binary: Replace each octal digit with its 3-bit binary equivalent.
- Binary to hex: Group into sets of 4 bits from right, replace each group with hex digit.
- Hex to binary: Replace each hex digit with its 4-bit binary equivalent.
- Fractional decimal to binary: Repeated multiplication by 2, read integer parts top-to-bottom.
- ASCII: 7-bit, 128 characters, English only. Key values: Space=32, '0'=48, 'A'=65, 'a'=97.
- ISCII: 8-bit, 256 characters, Indian scripts, backward compatible with ASCII.
- Unicode: Universal standard, 149,000+ characters, all world scripts.
- UTF-8: Variable length (1-4 bytes), backward compatible with ASCII, most used on the web.
- UTF-16: Variable length (2-4 bytes), used by Windows and Java internally.
- UTF-32: Fixed length (4 bytes), simple but memory-heavy.
- Always write the base subscript with your answers.
- Always verify by converting back to the original base.
- Grouping from the right is crucial for binary-to-octal and binary-to-hex conversions.
- A=10, B=11, C=12, D=13, E=14, F=15 in hexadecimal — memorize these.
- Computers use binary because electronic circuits have two states: ON (1) and OFF (0).
