Learning Objectives
- Explain why computers use binary and how bits and bytes measure storage.
- Convert between decimal, binary, and hex and state how many values n bits hold.
- Compare ASCII and Unicode and choose the right encoding for Nepali text.
- Show how images, sound, video, and programs become binary.
Later: computer generations, memory hierarchy.
The core idea
Computers know only on and off, so they use binary, 1 and 0. Two voltage levels stay stable. Ten would wobble. Every file must become 1s and 0s before processing.
flowchart TB
Raw["Data"] --> Bin["Binary 0/1"] --> Byte["Bytes"] --> Codes["Codes"] --> Media["Pixels, Samples, Code"]
Framework 1: Units and numbers
Bits and bytes
- Bit - 0 or 1.
- Nibble - 4 bits.
- Byte - 8 bits, holds 256 values (2 to 8). Counts in powers of 2: 1 KB = 1,024 bytes, 1 MB = 1,024 KB, 1 GB = 1,024 MB, 1 TB = 1,024 GB. Manufacturers use 1,000, so a 1 TB drive shows about 931 GB.
n bits hold 2 to the n values: 8 bits 256, 16 bits 65,536.
Number systems
| System | Base | Digits | Example | Note |
|---|---|---|---|---|
| Binary | 2 | 0, 1 | 1101 |
Inside machine |
| Decimal | 10 | 0 to 9 | 13 |
People |
| Hexadecimal | 16 | 0 to 9, A to F | D |
One hex = 4 bits |
Hex shortens binary. Colour #FF0000 is red. Addresses use hex.
Conversions
13 to binary - divide by 2 and read remainders upward: 13 gives 1101. Binary 1101 to decimal - 1 times 8 + 1 times 4 + 0 times 2 + 1 times 1 = 13. Hex A3 to binary = 10100011.
Framework 2: Text codes
-
ASCII - 7 bit gives 128 codes for English. Extended 8 bit gives 256. Example
A= 65 =01000001,0= 48 =00110000. English only. -
Unicode - variable 1 to 4 bytes in UTF 8, over a million codes for all scripts.
नis U+0928, so “नेपाल” needs Unicode. UTF 8 keeps ASCII as first 128 codes.
Preeti stores font pictures, not codes. On other machines it shows random English letters. Unicode stores the code, so text travels correctly.
| Lens | ASCII | Unicode UTF 8 |
|---|---|---|
| Bits per char | 7 or 8 | 1 to 4 bytes |
| Characters | 128 | Over a million |
| Languages | English | All scripts |
| Use today | Legacy | Web and mobile |
Self-check
Framework 3: Media and programs
- Images - pixels with 24 bit colour = 16.7 million colours. 1920 by 1080 at 24 bit = about 6.2 MB. JPEG compresses to hundreds of KB.
- Sound - samples per second as numbers. CD is 44,100 per second at 16 bits. One minute stereo is about 10.6 MB before compression.
- Video - frames plus sound, compressed.
- Programs - Python or Java compiles to machine code. Each instruction holds opcode and operands as bits.
A 6 MB image posted ten times a day fills a 1 GB plan in 16 days.
Nepal worked example: a Janakpur team that priced font versus code (NPR, BS 2081)
A Janakpur team holds 2,400 articles in Preeti before 2081-03-01, plus 110 photos at 3.2 MB each about 352 MB total. As of 2081-04-05 articles cannot be searched in Unicode nor posted cleanly.
On 2081-04-10 conversion to Unicode is quoted at NPR 12,000, about NPR 5 per article. A 1 TB NVMe for daily work is NPR 9,500, HDD stays for backup. Cloud sync is about NPR 400 per 100 GB.
To 2081-06-10 searching saves 6 hours at NPR 350 = NPR 2,100 per month. Publishing without retyping saves 4 hours = NPR 1,400. Combined NPR 3,500 repays NPR 12,000 in 3.5 months. Readers now see correct Nepali on all phones. Posting a 6.2 MB uncompressed frame instead of 350 KB multiplies cost by about 18 times for no gain.
Example 1: In a finance or registry reading, the encoding choice is a compliance choice. Ask: can the ledger search for member name “कुमार” in Unicode and produce the same result on audit laptop and branch PC as of BS 2081-04-15, or does a Preeti file break the search and force retyping.
Example 2: In a media or marketing reading, the encoding and media size is a publishing choice. Ask: does the site store text as Unicode so headline and share card show correctly on every phone, and does the upload pipeline compress a 6.2 MB frame to under 400 KB before it spends customer data.
Key Takeaways
- Binary is the stable base, all data becomes bits.
- One byte is 8 bits and holds 256 values. n bits hold 2 to the n.
- One hex digit equals 4 bits.
- ASCII fits English only, Unicode fits all scripts.
- Images are pixels, sound is samples, programs are opcodes, all as binary.
- Choice of JPEG size or Unicode versus font changes rupees and hours.
Discussion Questions
- Why do circuits prefer two states rather than ten for decimal.
- When is ASCII enough and when must you use Unicode.
- Why does an uncompressed photo cost many times more in storage and data than a JPEG.
Exercises
Short answer
- Define bit, nibble, and byte. How many values do 10 bits hold.
- Convert 25 decimal to binary and
10110binary to decimal. - Differentiate ASCII and Unicode on bits per character and languages covered.
Long answer
- Explain how computers represent numbers, text, images, sound, and programs, with conversion examples and a table for ASCII versus Unicode.
- Why is Unicode needed for Nepali. Show with Preeti versus Unicode problems and a storage estimate.


