Lesson 7 — Beginner

Data Representation (Text, Image, Audio)

Computer ke andar sab kuch 0 aur 1 hai — text, image, audio sab. Is lesson mein hum dekhenge har cheez binary mein kaise represent hoti hai: ASCII/Unicode se text, pixels se image, samples se sound.

⏱ 13 min• Beginner• Number Systems

Text representation — ASCII & Unicode

WHAT

Text ko characters mein tod kar represent karte hain. Har character ka ek number code hota hai. ASCII 7-bit (128 chars), Unicode 8-32 bit (lakhon chars, har language).

WHEN

Jab bhi koi letter/type store ho — A naam ka char nahi, balki ek number (ASCII 65) save hota hai.

WHERE

Files, programming strings, web pages — har text ke peeche character encoding hoti hai (UTF-8 aaj standard hai).

ASCII (7 bit → 128 characters)
  A = 65,  B = 66,  a = 97,  0 = 48,  Space = 32
  Ek char = 1 byte (8 bits mein 7 use + 1 parity/reserved)

Unicode (UTF-8 variable length)
  English = 1 byte, Hindi/Devanagari = 3 bytes
  Ek line = "Namaste नमस्ते" → dono sahi chhape

"Hi" store karne ke liye: 72, 73 (ASCII)
Yaad rakho: ASCII mein capital A=65 (small a=97). Ye 32 ka difference (65↔97) yaad rakho — programming questions mein kaam aata hai.

Numbers ka representation

Integers, floats, aur negative numbers alag-alag tarah store hote hain:

Unsigned int  : sirf positive, saare bits magnitude ke liye
Signed int    : sign ke liye ek bit (0=+, 1=-)
              Sign & magnitude / 1s complement / 2s complement

2s complement (standard) : -5 ka binary = inverting + 1
Floating point (IEEE 754) : sign + exponent + mantissa
  0 01111111 000... = 1.0 (example)

2s complement sabse zyada use hota hai kyunki isme addition aur subtraction ka alag logic nahi chahiye — ek hi circuit dono kar leta hai.

Image representation

Image = grid of pixels (picture elements). Har pixel ka color numbers mein store hota hai:

Resolution  : 1920×1080 = width × height pixels
Color depth : kitne bits per pixel
  1 bit  → black/white (1-bit)
  8 bit  → 256 shades of gray
  24 bit → RGB (8+8+8) = 16.7M colors (True Color)

File size (uncompressed) = Width × Height × ColorDepth / 8 bytes
1920×1080×24/8 = 6,220,800 bytes ≈ 6 MB
Pro Tip: Resolution zyada = detail zyada but file bhi bada. Color depth zyada = colors zyada. Ye do factor image quality decide karte hain — exam mein formula bhi aata hai.

Audio representation (sampling)

Sound continuous (analog) hota hai. Computer ise sample le kar digital banata hai — ye process sampling kehlaata hai:

Sampling rate : kitne samples per second (Hz)
  CD quality = 44,100 samples/sec (44.1 kHz)
Bit depth     : har sample ko kitne bits mein represent
Channels      : mono (1) / stereo (2)

File size/sec = SamplingRate × BitDepth × Channels / 8
CD stereo 16-bit: 44100 × 16 × 2 / 8 = 176,400 bytes ≈ 176 KB/sec

Nyquist theorem : sampling rate ≥ 2× max frequency

Exercise

Question: ASCII mein capital A ka number kya hai? Sirf number daalo.

Question: Ek uncompressed 8-bit grayscale image ka size (bytes) 10×10 pixel ke liye kitna? Sirf number.

Question: CD quality audio ki sampling rate (Hz) kitni hoti hai? Sirf number.

Common mistakes

Desi example: WhatsApp photo ka size

Tumhari 12MP camera ki photo ~6MB aati hai. Compression (JPEG) use karke 100KB mein aa jaati hai — pixels ghate nahi, redundancy hatati hai:

text
Raw : 4000×3000×24/8 ≈ 36 MB
JPEG: same pixels, smart compression → 200 KB
Video bhi frame sequence + audio samples hoti hai
Exam mapping (TCS / GATE)
  • TCS NQT: "ASCII value of A?" — 65 (classic).
  • GATE: image size formula + sampling rate (Nyquist).
  • Trap: Unicode UTF-8 mein Hindi char 1 byte nahi — 3 bytes hota hai.
Lesson complete?

Data representation clear. Agla lesson — CPU Architecture — mein dekhenge processor kaise chalta hai (fetch-decode-execute).

Popular courses: Data Science Course in Lucknow · AI Course in Lucknow · Python Course in Lucknow · Power BI Course · Data Analytics Course