5 Basics of Computers · 5.1 Computer basics: number systems, codes, logic, algorithms and spreadsheets

5.1.4 Codes (BCD, ASCII, EBCDIC, Unicode), bits, bytes, words and computer memory

Computers store everything as bits; codes (BCD, ASCII, EBCDIC, Unicode) decide which bit pattern stands for which digit or character, and memory holds these patterns in a hierarchy from fast, small registers and cache to large, slow secondary storage.

  • APPSC Paper I
  • Advanced level
  • 7 min read
  • Free

Free PDF

Download this PDF

Enter your email once and the PDF is yours. We send exam updates and free material; you can stop them any time.

In the print window, choose Save as PDF.

Core facts

  • Bit = binary digit (0 or 1), the smallest unit. Nibble = 4 bits. Byte = 8 bits (one character in ASCII). Word = the number of bits the CPU handles as one unit (16, 32 or 64 bits; machine-dependent).
  • Units (binary convention used in textbooks):
UnitEqualsPower of 2
1 KB1,024 bytes2¹⁰
1 MB1,024 KB2²⁰
1 GB1,024 MB2³⁰
1 TB1,024 GB2⁴⁰
  • Beyond TB: PB (2⁵⁰), EB (2⁶⁰), ZB (2⁷⁰), YB (2⁸⁰).
  • BCD (8421 code): each decimal digit in 4 bits; 1010 to 1111 are unused (invalid).
  • Excess-3: BCD + 3 (0011) for each digit; self-complementing.
  • Gray code: consecutive values differ in only one bit (unit-distance, reflected binary code).
  • ASCII: American Standard Code for Information Interchange, 7-bit, 128 characters; extended ASCII uses 8 bits (256).
  • EBCDIC: Extended Binary Coded Decimal Interchange Code, 8-bit, developed by IBM for mainframes.
  • ISCII: Indian Script Code for Information Interchange, 8-bit, BIS standard of 1991.
  • Unicode: one code for every script in the world; code points U+0000 to U+10FFFF (1,114,112). Encodings: UTF-8 (1 to 4 bytes, ASCII-compatible), UTF-16 (2 or 4 bytes), UTF-32 (4 bytes).
  • ASCII values: 'A' = 65, 'a' = 97, '0' = 48, space = 32.
  • Primary memory: RAM (volatile, read/write) and ROM (non-volatile, read-only). Secondary: hard disk, SSD, pen drive, CD/DVD, tape (non-volatile).
  • Fastest to slowest: registers → cache → RAM → secondary storage.

Explained

1. Codes for numbers.

Example 1. Write 59 in BCD and in pure binary. Solution. BCD codes each digit: 5 = 0101, 9 = 1001 → 0101 1001 (8 bits). Pure binary: 59 = 111011 (6 bits). BCD needs more bits but converts easily to and from decimal display.

Example 2. Find the excess-3 code of decimal 5 and the Gray code of binary 1011. Solution. 5 + 3 = 8 → 1000. Gray: keep the first bit (1), then XOR each pair of neighbours: 1⊕0 = 1, 0⊕1 = 1, 1⊕1 = 0 → 1110.

2. Codes for characters. Upper case 'A' to 'Z' are 65 to 90; lower case 'a' to 'z' are 97 to 122; a lower-case letter is its capital + 32. Digits '0' to '9' are 48 to 57, so the character '7' is not the number 7.

Example 3. The ASCII code of 'D' in decimal and binary is (a) 68, 1000100 (b) 100, 1100100 (c) 67, 1000011 (d) 68, 1000010 Solution. 'A' = 65, so 'D' = 68 = 64 + 4. Answer: (a)

Code comparison

CodeBitsCharactersUse
ASCII7128PCs, internet text
EBCDIC8256IBM mainframes
ISCII8Indian scriptsolder Indian software
Unicode8/16/32 unitsall scriptsmodern systems, web

Telugu has its own Unicode block, U+0C00 to U+0C7F, which is why Telugu text typed on a phone displays correctly on any computer.

3. Parity bit. An extra bit added so that the number of 1s is even (even parity) or odd (odd parity); it detects a single-bit error but cannot correct it.

Example 4. Find the even-parity bit for 1011001. Solution. It has four 1s, already even. Answer: 0 (odd parity would need 1)

4. Kinds of memory.

TypeVolatile?Feature
SRAMYesflip-flops, fast, no refresh; used in cache
DRAMYescapacitors, must be refreshed; main memory
ROM / PROMNoPROM written once by the user
EPROM / EEPROMNoerased by UV light / electrically
  • Flash memory is a kind of EEPROM erased in blocks; it is used in pen drives, memory cards and SSDs.
  • Firmware (BIOS/UEFI start-up program) is kept in ROM or flash.
  • Cache sits between CPU and RAM; levels L1 (fastest, smallest), L2, L3.
  • Registers are inside the CPU (accumulator, program counter, instruction register).
  • Secondary storage: hard disk (magnetic; tracks, sectors, cylinders), SSD (flash, no moving parts), optical discs (CD about 700 MB, DVD 4.7 GB single layer, Blu-ray 25 GB single layer), magnetic tape (sequential access, backups).

Deeper

  • Memory hierarchy: going down (register → cache → RAM → disk → tape), speed falls, capacity rises and cost per bit falls. The hierarchy works because programs reuse nearby data (locality of reference); the fraction of requests found in cache is the hit ratio.
  • Access: RAM is random access (equal time for any location); tape is sequential; disk is direct (semi-random) access. Disk access time = seek time + rotational latency (+ transfer time).
  • Virtual memory: part of the hard disk used as an extension of RAM, so programs larger than RAM can run; pages are swapped in and out.
  • Address lines and capacity: n address lines select 2ⁿ locations; capacity = 2ⁿ × word size.
  • Units in practice: disk makers use decimal units (1 GB = 10⁹ bytes); the IEC names KiB, MiB, GiB for 2¹⁰, 2²⁰, 2³⁰. Exams follow the textbook convention 1 KB = 1,024 bytes unless told otherwise.

Example 5. A memory chip has 16 address lines and an 8-bit word. What is its capacity? (a) 16 KB (b) 32 KB (c) 64 KB (d) 128 KB Solution. 2¹⁶ = 65,536 locations × 1 byte = 65,536 bytes = 64 KB. Answer: (c) 64 KB

Example 6. How much memory can a CPU with a 32-bit byte address address? Solution. 2³² bytes = 2² × 2³⁰ bytes. Answer: 4 GB

Example 7. How many bits are there in 2 KB? Solution. 2 × 1,024 × 8. Answer: 16,384 bits

Example 8. Which is non-volatile? (a) SRAM (b) DRAM (c) Cache (d) EEPROM Solution. RAM and cache lose data when power is off. Answer: (d) EEPROM

Common traps

  • ✗ "ASCII is an 8-bit code of 256 characters." ✓ Standard ASCII is 7-bit, 128; 8-bit is extended ASCII.
  • ✗ "EBCDIC was developed by ANSI." ✓ IBM; ASCII came from the American standards body.
  • ✗ "BCD of 59 = 111011." ✓ That is pure binary; BCD is 0101 1001.
  • ✗ "1 KB = 1,000 bytes" (in a computer-basics paper). ✓ 1,024 bytes.
  • ✗ "A word is always 16 bits." ✓ Word length depends on the processor.
  • ✗ "DRAM is used for cache." ✓ Cache uses SRAM; DRAM needs refreshing and is main memory.
  • ✗ "EPROM is erased electrically." ✓ EPROM is erased by ultraviolet light; EEPROM electrically.
  • ✗ "'a' = 65." ✓ 'A' = 65, 'a' = 97.

Quick revision

  • Nibble 4 bits, byte 8 bits, word = CPU unit (machine-dependent).
  • KB 2¹⁰, MB 2²⁰, GB 2³⁰, TB 2⁴⁰ bytes.
  • BCD: 4 bits per decimal digit; excess-3 = BCD + 3.
  • Gray code: one bit changes at a time.
  • ASCII 7-bit (128); EBCDIC 8-bit (IBM); ISCII 1991; Unicode all scripts.
  • 'A' 65, 'a' 97, '0' 48.
  • Parity bit detects a single-bit error.
  • SRAM cache, DRAM main memory; EPROM UV, EEPROM electric.
  • Registers → cache → RAM → disk: slower, bigger, cheaper.
  • n address lines → 2ⁿ locations.

Sources: NCERT Computer Science, Class 11 (computer system, encoding schemes); Telugu Akademi / APSCHE, B.Com and B.Sc. first year, Fundamentals of Computers (codes, memory); P.K. Sinha, Computer Fundamentals (standard text); M. Morris Mano, Digital Logic and Computer Design (binary codes); Unicode Consortium, The Unicode Standard (unicode.org), code charts; Bureau of Indian Standards, IS 13194:1991 (ISCII)

Last checked 2026-10-21.

Practise this topic. Questions on Codes, bits, bytes & memory, with answers explained.

Medha AI writes its own notes and checks them against the sources listed. Medha AI is an independent preparation service. It is not affiliated with, endorsed by or connected to APPSC, TSPSC, MPSC, UPSC or any other commission or government body.