Understanding How Computers Store Text1. The Basic Idea#
Computers only understand numbers! So every letter, number, and symbol needs a number code.
2. ASCII - The American Standard#
What is ASCII?#
Made for old computers and typewriters
ASCII Conversion Chart#
A=65 B=66 C=67 D=68 E=69 F=70 G=71
H=72 I=73 J=74 K=75 L=76 M=77 N=78
O=79 P=80 Q=81 R=82 S=83 T=84 U=85
V=86 W=87 X=88 Y=89 Z=90
a=97 b=98 c=99 d=100 e=101 f=102 g=103
h=104 i=105 j=106 k=107 l=108 m=109 n=110
o=111 p=112 q=113 r=114 s=115 t=116 u=117
v=118 w=119 x=120 y=121 z=122
0=48 1=49 2=50 3=51 4=52
5=53 6=54 7=55 8=56 9=57
Space=32 !=33 @=64 #=35 $=36
%=37 &=38 *=42 +=43 -=45
/=47 :=58 ;=59 ?=63
ASCII assigns a number to every letter, number, or symbol on a keyboard.It uses 7 bits per character (sometimes 8 bits with a leading zero).
Uppercase and lowercase letters have different ASCII values.
Each next character’s ASCII value is 1 more than the previous one.
Example:#
ASCII uses one byte (8 bits) to store each character.Example:#
The letter 'A' has ASCII value 65, which in binary is:Word Conversion Examples#
"HELLO" = 72, 69, 76, 76, 79H=72, E=69, L=76, L=76, O=79
"hello" = 104, 101, 108, 108, 111h=104, e=101, l=108, l=108, o=111
"Code123" = 67, 111, 100, 101, 49, 50, 51C=67, o=111, d=100, e=101, 1=49, 2=50, 3=51
3. Unicode - The Global Standard#
What is Unicode?#
Created for the whole world
Over 1 million codes (and growing!)
Includes all languages + emoji
How Unicode Works with ASCII#
Keeps the same codes for English letters (A=65, a=97, etc.)
Adds thousands more codes for other languages
Unicode Examples#
"ñ" = 241 (Spanish - NOT in ASCII)
"字" = 23383 (Chinese - NOT in ASCII)
"😂" = 128514 (emoji - NOT in ASCII)
4. Quick Comparison#
| ASCII | Unicode |
|---|
| Size | 128 codes | 1,000,000+ codes |
| Languages | English only | All languages |
| Emoji | ❌ No | ✅ Yes |
| Modern Use | Rare | Everywhere! |
5. Practice Problems#
Convert to ASCII:#
What's Missing in ASCII?#
4.
Can ASCII handle "café"? Why? ______
5.
Can ASCII handle "😊"? Why? ______
Answers:#
5.
No - emoji aren't in ASCII
6. Key Points to Remember#
✅ ASCII = Small English-only code system
✅ Unicode = Huge global code system
✅ Your phone/computer uses Unicode to handle all languages and emoji
✅ ASCII codes are preserved in Unicode for English letters
Real-World Connection#
Unicode lets you text in any language
Unicode makes emoji possible 😎
Websites can show content from any country
Your games can have special symbols and characters
ASCII = Only knowing English
Unicode = Knowing every language in the world!
Study Tip: Memorize A=65, a=97, 0=48 - you can figure out the rest from there! 🎯
Sound Representation#
Sound is an analogue wave — smooth and continuous.
To store sound digitally, the wave is sampled at regular time intervals.
Each sample measures the amplitude (height) of the wave.
The sampling rate is how many samples are taken per second (in Hertz).
The bit depth (sampling resolution) is how many bits store each sample.
Higher sampling rate and bit depth improve sound quality but increase file size.
Example:
CD quality audio: 44,100 samples/second at 16 bits per sample.
Sound File Size Calculation#
| Parameter | Value |
|---|
| Sample rate | 44,100 samples/second |
| Bit depth | 8 bits per sample |
| Channels | 2 (stereo) |
| Duration | 1 second |
Formula:
File size (bits) = sample rate × bit depth × channels × durationCalculation:
44,100 × 8 × 2 × 1 = 705,600 bits
Bytes = 705,600 ÷ 8 = 88,200 bytes
KiB = 88,200 ÷ 1024 ≈ 86.13 KiB
Image Representation (Bitmap)#
Images are made of tiny dots called pixels.
Each pixel is stored as a binary number.
Colour depth is the number of bits per pixel.
| Colour Depth | Number of Colours |
|---|
| 1 bit | 2 colours (black or white) |
| 8 bits | 256 colours |
| 24 bits | 16,777,216 colours (true color) |
Image resolution = width × height in pixels (e.g., 1920 × 1080).
Higher resolution and colour depth mean better quality but larger file size.
File size formula:
File size (bits) = resolution × colour depth
Convert to bytes by dividing by 8.
Practice Questions#
1.
Find ASCII code for 'a' and write its 8-bit binary.
Answer: ASCII 97 → binary 01100001
2.
Why is Unicode better for world languages?
Answer: It supports many languages and symbols beyond English.
3.
Calculate file size for an 800 × 600 image with 24-bit colour in KiB.
Answer: (800 × 600 × 24) ÷ 8 = 1,440,000 bytes ≈ 1406.25 KiB
4.
What happens to file size if colour depth reduces from 24-bit to 8-bit?
Answer: File size becomes one-third, because fewer bits per pixel are used.
5.
Calculate bits needed for 1 second of stereo sound at 8-bit and 44,100 Hz.
Answer: 44,100 × 8 × 2 × 1 = 705,600 bits (~86.13 KiB)
Modified at 2025-11-11 09:37:52