Computer Science · Ch 2 — Encoding Schemes and Number System
Summary
Summary
- An encoding scheme maps text into codes, which is what makes communication among computers possible — every key pressed is mapped to a unique code value, which is then converted to binary.
- Textual data is encoded using ASCII, ISCII or UNICODE.
- ASCII (early 1960s) is a 7-bit scheme: 2^7 = 128 characters, covering the English character set only. The ASCII code of 'A' is 65.
- ISCII (mid 1980s, India) is an 8-bit scheme (2^8 = 256 codes) that retains all 128 ASCII codes and assigns codes 160–255 to the aksharas of Indian scripts.
- UNICODE is a character encoding standard that can encode the characters of almost all languages of the world, giving every character a unique number regardless of device, operating system or application. Common encodings: UTF-8, UTF-16, UTF-32. It is a superset of ASCII (values 0–128 unchanged).
- A number system is a method to represent numbers; the count of its unique literals is its radix or base. The four systems used with computers: binary (base 2: 0,1), octal (base 8: 0–7), decimal (base 10: 0–9) and hexadecimal (base 16: 0–9, A–F).
- These are positional systems: each symbol contributes (symbol value × base^position), with position 0 at the right-most integer digit and negative positions (−1, −2, ...) after the point.
- A computer, being a digital system, understands only binary numbers — 0 and 1 (the OFF/low and ON/high states of transistors). Encoded text is converted to binary form for processing.
- Octal and hexadecimal simplify binary-coded representation, since they allow grouping of 3 or 4 binary bits respectively (8 = 2^3, 16 = 2^4). Applications include compact memory addresses (for example, [PII:card] → C0F1) and RGB web-colour codes (RED = FF,00,00).
- Decimal → other system: repeatedly divide by the base, collect remainders bottom to top. Example: (65)10 = (1000001)2 = (101)8 = (41)16.
- Other system → decimal: multiply each symbol by its positional value (base^position) and add. Examples: (1101)2 = (13)10; (257)8 = (175)10; (3A5)16 = (933)10.
- Binary ↔ octal/hexadecimal: group bits 3 (octal) or 4 (hexadecimal) at a time from right to left and substitute; pad with leading 0s if needed. Reverse: expand each digit to its 3-/4-bit group. …