1.1.2 · HinglishHow Computers Work

Hexadecimal and octal — conversions, why they're used

1,566 words7 min readRead in English

1.1.2 · Coding › How Computers Work


WHAT hain yeh number systems?


Power-of-2 shortcut (key skill)

Figure — Hexadecimal and octal — conversions, why they're used

Worked examples


Common mistakes (steel-manned)


Recall Feynman: 12-saal ke bacche ko explain karo

Imagine karo binary ek lamba zip-code hai sirf 0s aur 1s ka — super accurate lekin padhna thaka dene wala. Hexadecimal jaisa hai jaise un 4 0/1 lights ko pack karo ek symbol mein (0–9 phir A–F). Kyunki exactly "chaar lights ki worth" possibilities hai, tum long zip-code aur short symbols ke beech sirf apni ungli 4 lights ek waqt mein slide karke swap kar sakte ho — koi maths nahi, sirf chopping. Octal same karta hai lekin 3 lights ek waqt mein chops karta hai. Computers inhe isliye use karte hain kyunki yeh binary ke under same hain, lekin human eyes ke liye kaafi aasaan hain.


WHY hex/octal real computing mein matter karte hain

  • Memory addresses aur colors: 0xFF0000 (red), addresses jaise 0x7FFF — compact, byte-aligned (1 byte = 2 hex digits).
  • Bit masks aur flags: 0x0F clearly matlab "low 4 bits set."
  • File permissions (Unix): chmod 755 octal use karta hai kyunki permissions 3 bits ke groups mein aati hain (rwx).
  • Debugging: Memory dumps hex mein dikhaye jaate hain taaki har byte ek tidy 2-digit pair ho.

Flashcards

Binary represent karne ke liye hexadecimal ko decimal ke upar kyun prefer kiya jaata hai?
Kyunki , har hex digit exactly 4 bits se map hoti hai bina kisi arithmetic ke — conversion pure grouping hai.
Ek octal digit kitne bits represent karta hai, aur kyun?
3 bits, kyunki isliye octal digits 0–7 range karte hain = exactly 3 bits ki values.
Hex digits A se F ki value kya hai?
A=10, B=11, C=12, D=13, E=14, F=15.
ko hex mein convert karo.
(1101=13=D, 0110=6).
ko repeated division se hex mein convert karo.
(remainders 12=C, 11=B, 2 — bottom-to-top padho).
Binary ko hex mein group karte waqt, kis side se group karte hain, aur kyun?
Right se, kyunki place value rightmost bit () pe anchored hai.
Decimal→base-b division se remainders padhte waqt, kaun sa order?
Bottom-to-top (last remainder most significant digit hai).
Base se repeated division digits kyun extract karta hai?
units digit ke barabar hai; divide karne se yeh hat jaata hai toh next remainder next digit hai.
Prefixes 0b, 0o, 0x ka matlab kya hai?
Krama se Binary, octal, hexadecimal literals.
ko binary mein instantly convert karo.
2=0010, B=1011, C=1100 → .

Connections

  • Binary number system — underlying base jise hex/octal abbreviate karta hai.
  • Positional notation and place value — master equation .
  • Bytes and memory addressing — kyun 2 hex digits = 1 byte.
  • Bitwise operations and masks — hex masks ko readable banata hai.
  • Unix file permissions (chmod) — octal practice mein.
  • ASCII and character encoding — code points hex mein dikhaye jaate hain.

Concept Map

hard for humans

need shorthand

2^3

2^4

1 digit = 3 bits

1 digit = 4 bits

derived from

repeated division

converts to

sum digits

Binary base-2

Human unreadable long strings

Base = power of 2

Octal base-8

Hex base-16

Place value equation N=sum di b^i

Group bits, no arithmetic

Divide-remainder for decimal

Decimal value