Lesson 6 — Beginner

Binary & Number Systems

Computer sirf 0 aur 1 samajhta hai — sab kuch binary mein. Is lesson mein hum dekhenge number systems kya hain, binary ko decimal mein kaise convert karte hain, aur hexadecimal kyun use hota hai.

⏱ 15 min• Beginner• Computer Basics

Number systems kya hain

WHAT

Number system base (radix) par chalta hai. Base = digits kitne hain. Decimal base-10 (0-9), Binary base-2 (0,1), Octal base-8, Hexadecimal base-16 (0-9 + A-F).

WHEN

Computer se baat karne (programming), networking (IP address), aur exams (quant + CS) mein har jagah conversion chahiye.

WHERE

Binary computer ki zubaan hai, hexadecimal colors/addresses mein, octal old systems mein. IP address = dotted decimal jo binary hota hai.

Har digit apne position ke hisaab se power of base leta hai. Ye positional value ka concept hai — decimal mein bhi yahi hota hai bas hum ignore karte hain.

Binary/any base → Decimal conversion

Kisi bhi number ko decimal mein badalne ka rule: har digit × (base ^ position) — position right se 0 se shuru.

Binary 1011 → Decimal
= 1×2^3 + 0×2^2 + 1×2^1 + 1×2^0
= 8 + 0 + 2 + 1 = 11 (base 10)

Binary 110.11 → Decimal
= 1×2^2 + 1×2^1 + 0×2^0 + 1×2^-1 + 1×2^-2
= 4 + 2 + 0 + 0.5 + 0.25 = 6.75

Hex A3F → Decimal
= 10×16^2 + 3×16^1 + 15×16^0 = 2560 + 48 + 15 = 2623
Pro Tip: Exponent right se 0 se count karo, left of radix point se 0, aur uske baad decimal point ke baad se −1. Ye sign convention exam mein ghoom ke poochhta hai.

Decimal → Binary conversion (division method)

Decimal ko binary mein badalne ke liye base se divide karo aur remainders note karo, phir remainders ko ulta jodo:

Decimal 45 → Binary
45 ÷ 2 = 22 rem 1
22 ÷ 2 = 11 rem 0
11 ÷ 2 = 5  rem 1
5  ÷ 2 = 2  rem 1
2  ÷ 2 = 1  rem 0
1  ÷ 2 = 0  rem 1

Ult remainders (bottom→top): 101101
Check: 32+8+4+1 = 45 ✓

Fraction ke liye ×2 method (upar se digits lo):
0.75 × 2 = 1.5 → take 1
0.5  × 2 = 1.0 → take 1  ⇒ 0.11

Binary ↔ Hex ↔ Octal shortcut

Base-2, 8, 16 sab 2 ki power hain — isliye direct bit grouping se convert ho jaata hai, division ki zarurat nahi:

Binary → Hex : 4 bits ko ek digit banao
1101 0110 → D 6 = 0xD6
(1101=13=D, 0110=6)

Hex → Binary : har digit ko 4 bits banao
A3F → 1010 0011 1111

Binary → Octal : 3 bits group
101 011 → 5 3 = 053

Octal → Binary : har digit 3 bits
75 → 111 101
Yaad rakho: 4 bits = 1 hex digit, 3 bits = 1 octal digit. Isi wajah se binary↔hex itna fast hai — networking aur memory dump mein yahi use hota hai.

Exercise

Question: Binary 1010 ko decimal mein badlo. Sirf number daalo.

Question: Decimal 25 ko binary mein badlo. Sirf 0 aur 1 daalo.

Question: Hexadecimal mein 10 (das) kaunsa digit hota hai? (A/B/C/D)

Common mistakes

Desi example: IP address aur subnets

Har IP address binary hota hai. 192.168.1.1 = 11000000.10101000.00000001.00000001 — network engineers ise roz dekhte hain:

text
192 → 11000000
168 → 10101000
1    → 00000001
1    → 00000001
Har octet = 8 bits = 1 byte
Exam mapping (GATE / TCS / SSC)
  • TCS NQT: binary-decimal conversion 1-2Q.
  • GATE: base conversion + fractional part.
  • SSC: "What is 1011 in decimal?" — classic.
  • Trap: fractional binary mein point ke baad power NEGATIVE hoti hai (2^-1, 2^-2).
Lesson complete?

Number systems clear! Agla lesson — Data Representation — mein dekhenge text, image aur audio binary mein kaise store hote hain.

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