Free tutorials & notes in Hindi & English · Clean code examples 🧰 मुफ़्त PDF और फ़ोटो टूल्स →
🖥️ Unit 1 – Computer System और Organisation  ·  Lesson 04

Number Systems: Binary, Octal, Hex

Computer binary क्यों use करते हैं?

Computer के अंदर हर circuit एक छोटे switch जैसा है जो या तो ON है या OFF — current बहता है या नहीं। दो states बनाना आसान और बहुत भरोसेमंद है, इसलिए computer हर चीज़ दो digits से दिखाता है: 1 (ON) और 0 (OFF)। यही binary number system है। Numbers, letters, photos, music और Python programs भी आख़िर में 0 और 1 के patterns के रूप में store होते हैं।

switches →ONOFFONON
चार switches → 1 0 1 1 → decimal में 11

Base (radix) और place value

किसी number system का base (या radix) उसमें use होने वाले अलग digits की संख्या है। हर positional system में digit की value उसकी position पर निर्भर करती है। Positions दाईं ओर से 0, 1, 2 … गिनी जाती हैं और हर position का weight baseposition होता है।

SystemBaseDigitsExample
Decimal100 1 2 3 4 5 6 7 8 9(725)₁₀
Binary20 1(1011)₂
Octal80 1 2 3 4 5 6 7(375)₈
Hexadecimal160–9 और A B C D E F (A=10 … F=15)(2AF)₁₆

Decimal (base 10)

यह वह system है जो हम रोज़ use करते हैं। 725 में: 7 सैकड़े (hundreds) पर, 2 दहाई (tens) पर और 5 इकाई (ones) पर है।

DigitPositionWeightValue
7210² = 100700
2110¹ = 1020
5010⁰ = 15
725 = 700 + 20 + 5

Binary (base 2)

सिर्फ़ digits 0 और 1 allowed हैं। हर binary digit एक bit है। Place values दाएँ से बाएँ दोगुनी होती हैं: 1, 2, 4, 8, 16, 32, 64, 128 …

weight →1286432168421
8-bit binary number की place values
bits →00101101
(00101101)₂ = 32 + 8 + 4 + 1 = 45

सबसे दाईं bit Least Significant Bit (LSB) है; सबसे बाईं Most Significant Bit (MSB)। 0 पर ख़त्म होने वाला binary number even है; 1 पर ख़त्म होने वाला odd।

Octal (base 8)

Octal में digits 0 से 7 हैं। Weights 1, 8, 64, 512 … हैं। क्योंकि 8 = 2³, एक octal digit = ठीक 3 bits। Octal पुराने computers में popular था और Linux में file permissions के लिए आज भी use होता है, जैसे chmod 755।

Example: (57)₈ = 5 × 8 + 7 × 1 = 40 + 7 = decimal में 47।

Hexadecimal (base 16)

Hexadecimal को 16 symbols चाहिए, इसलिए 9 के बाद letters use करते हैं: A = 10, B = 11, C = 12, D = 13, E = 14, F = 15। क्योंकि 16 = 2⁴, एक hex digit = ठीक 4 bits। Weights 1, 16, 256, 4096 … हैं।

🎨
Colour codes#FF0000 लाल है: FF red, 00 green, 00 blue।
🧠
Memory addressesDebuggers 0x7ffe4a10 जैसे addresses दिखाते हैं।
📶
MAC addressNetwork cards: 3C:52:82:1A:9F:07।
🔤
UnicodeHindi अक्षर अ का code U+0905 है।
Hexadecimal कहाँ दिखेगा

Example: (2F)₁₆ = 2 × 16 + 15 × 1 = 32 + 15 = 47।

Comparison table 0–16

Table रटने की जगह Python से print कराएँ। देखिए hex 15 पर F तक पहुँचता है, और octal 8 पर "carry" होकर 10 बनता है।

Python
print('Dec  Bin   Oct  Hex')
for n in range(0, 17):
    print(f'{n:>3}  {n:>04b}  {n:>3o}  {n:>3X}')
Dec Bin Oct Hex 0 0000 0 0 1 0001 1 1 2 0010 2 2 3 0011 3 3 4 0100 4 4 5 0101 5 5 6 0110 6 6 7 0111 7 7 8 1000 10 8 9 1001 11 9 10 1010 12 A 11 1011 13 B 12 1100 14 C 13 1101 15 D 14 1110 16 E 15 1111 17 F 16 10000 20 10
💡 याद रखने का तरीका

0–15 का binary (4-bit patterns) याद कर लें। इन 16 patterns से आप कोई भी binary ↔ hex तुरंत बदल सकते हैं, और पहले 8 (3-bit) patterns से binary ↔ octal।

Python में number systems

Python में दूसरे bases में number देखने के built-in functions हैं: bin(), oct(), hex()। Prefix 0b, 0o, 0x बताते हैं कि base कौन सा है। int(text, base) वापस decimal में बदलता है।

Python
n = 45
print(bin(n))     # binary
print(oct(n))     # octal
print(hex(n))     # hexadecimal
print(int('101101', 2), int('55', 8), int('2D', 16))
0b101101 0o55 0x2d 45 45 45

आप सीधे भी इन bases में numbers लिख सकते हैं: 0b1010 = 10, 0o17 = 15 और 0xFF = 255।

सारांश और practice

  • Base = digits की संख्या: decimal 10, binary 2, octal 8, hexadecimal 16।
  • Value = Σ digit × baseposition, position दाईं ओर से 0 से।
  • 1 octal digit = 3 bits; 1 hex digit = 4 bits।
  • Python: bin(), oct(), hex(), int(s, base)।
✅ Practice

1) इनमें से कौन valid octal number नहीं है: 175, 382, 66? 2) (1F)₁₆ की decimal value क्या है? 3) Hex number 3A9 लिखने में कितने bits लगेंगे?

Answers: 1) 382 (digit 8 allowed नहीं)। 2) 31। 3) 3 hex digits × 4 = 12 bits।

अक्सर पूछे जाने वाले प्रश्न (FAQ)

Computer binary में काम करते हैं तो hexadecimal क्यों?
लंबे binary numbers इंसानों के लिए पढ़ना मुश्किल है। एक hex digit ठीक 4 bits के बराबर है, इसलिए 11111111 सिर्फ़ FF बन जाता है। यह colour codes, memory addresses और MAC addresses में use होता है।
Octal number system का base क्या है?
Base 8 है और digits 0 से 7। एक octal digit ठीक 3 bits के बराबर है।
Number का base कैसे लिखते हैं?
Subscript में, जैसे binary के लिए (1011)₂, octal के लिए (17)₈, decimal के लिए (25)₁₀ और hexadecimal के लिए (1F)₁₆।
← Class 11 Computer Science
🔗

Share this topic with a friend

यह topic किसी दोस्त को भेजें

Found it useful? Send it to a classmate learning the same thing.

अच्छा लगा? जो दोस्त यही सीख रहा है, उसे भेज दीजिए।

अगला topicNumber System Conversions आपकी प्रगति: 4 / 29 (14%) · Lesson 5 / 29 आगे बढ़ें →

यह lesson कैसा लगा?

आपकी राय से हम content और बेहतर बनाते हैं।

अपना review और सुझाव लिखें (वैकल्पिक)

Review approve होने के बाद आपका नाम और शहर इसके साथ public दिख सकते हैं। Email या phone न लिखें।

▶ CodingEasily on YouTube

Video से सीखें – आसान Hindi में

चुनी हुई video: RDBMS भाग 3 – Class XI Commerce IT

▶ Channel subscribe करें