Recall warm-up
- How many bits are in 2 KB?
Stuck? Peek at 0.2.1 Bits, bytes and prefixes: powers of 10 for rates, powers of 2 for sizes
- 1 B = 8 b. Lower-case b = bit, upper-case B = byte.
- Rates: k = 10³, M = 10⁶, G = 10⁹ (bps).
- Sizes: K = 2¹⁰, M = 2²⁰, G = 2³⁰ (bytes) — unless the question says 1000.
- Time to push out = (size in bits) ÷ (rate in bit/s).
- ms = 10⁻³ s, µs = 10⁻⁶ s, ns = 10⁻⁹ s.
- Mesh vs star: links for n nodes?
Stuck? Peek at 0.1.2 Nodes, links, topologies, LAN/WAN and the boxes in the middle
- Node = any device; host = node where messages start/end.
- Point-to-point (2 nodes) vs broadcast (all hear all).
- Simplex (one way) · half-duplex (two ways, one at a time) · full-duplex (both at once).
- Links: mesh n(n−1)/2, star n, ring n, tree n−1, bus 1 backbone.
- LAN (building) ⊂ WAN (cities) ⊂ the Internet (network of networks).
- Hub repeats to all · switch delivers within a LAN · router picks the next network.
- Where does the meaning of a bit pattern come from?
Stuck? Peek at 0.1.1 Why networks exist: hosts, links and sending data
- Network = devices + links that exchange data.
- Host = where a message starts or ends (laptop, phone, server).
- Link = physical path: copper (voltage), fibre (light), wireless (radio).
- All content → bits → signals → bits → content; meaning comes from an agreed encoding.
- One link per pair of n hosts: n(n − 1)/2 links — too many, so links are shared.
The Hook
Every address, every length and every counter inside a network is a binary number stored in a fixed number of bits. Read the field wrong by one bit and you are off by a factor of two. Engineers write those numbers in hexadecimal because four bits fit exactly in one hex digit. Fluency here pays off in every phase that follows.
Predict First
A counter is stored in 8 bits. Guess the largest number it can hold: 8, 128, 255 or 256?
,255. 8 bits give 2⁸ = 256 different patterns, from 00000000 (0) to 11111111 (255). The count of patterns is 256; the largest value is one less.
Core Concept
Place value
Decimal: each place is worth 10 times the place to its right (1, 10, 100…). Binary is the same idea with 2: places are worth 1, 2, 4, 8, 16, 32, 64, 128…
| Place | 2⁷ | 2⁶ | 2⁵ | 2⁴ | 2³ | 2² | 2¹ | 2⁰ |
|---|---|---|---|---|---|---|---|---|
| Worth | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 |
| 11001000 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 0 |
Decimal → binary
Method: subtract the largest power of 2 that fits, mark a 1 in that place, repeat. Or divide by 2 repeatedly and read the remainders from bottom to top.
The supplied notes include an interactive visual for this concept; this reading view preserves the surrounding explanation and sequence.
Hexadecimal
Hex is base 16. Digits 0–9 then A=10, B=11, C=12, D=13, E=14, F=15. One hex digit = exactly 4 bits (a "nibble"), so binary ↔ hex is just grouping in fours from the right. Hex is often written with a prefix: 0xC8.
k bits give 2ᵏ values
With k bits there are 2ᵏ patterns, representing 0 to 2ᵏ − 1. To count N different things you need the smallest k with 2ᵏ ≥ N.
| k | 2ᵏ | k | 2ᵏ |
|---|---|---|---|
| 1 | 2 | 10 | 1,024 |
| 2 | 4 | 12 | 4,096 |
| 4 | 16 | 13 | 8,192 |
| 8 | 256 | 16 | 65,536 |
| 9 | 512 | 20 | 1,048,576 |
| 32 | 4,294,967,296 |
Putting it together
- Binary is place value with powers of 2; hex groups 4 bits per digit.
- k bits give 2ᵏ values, from 0 to 2ᵏ − 1.
- Bits needed for N values is the smallest k with 2ᵏ ≥ N.
Visual
| Decimal | Binary | Hex |
|---|---|---|
| 0 | 0000 | 0 |
| 5 | 0101 | 5 |
| 9 | 1001 | 9 |
| 10 | 1010 | A |
| 12 | 1100 | C |
| 15 | 1111 | F |
| 200 | 1100 1000 | C8 |
| 255 | 1111 1111 | FF |
Worked Examples
Write 200 in binary (8 bits) and in hex.
Show the full solution
200 − 128 = 72 → 72 − 64 = 8 → 8 − 8 = 0. Places 128, 64 and 8 are 1: 11001000. Group: 1100 | 1000 = C | 8 → 0xC8.
Convert 10110110 to decimal and to hex.
Show the full solution
128 + 32 + 16 + 4 + 2 = 182. Groups 1011 | 0110 = B | 6 → 0xB6.
(a) Convert 0x3F7 to decimal. (b) A field must hold every integer from 0 to 5000. What is the minimum number of bits? (c) What is the largest value of a 13-bit field?
Show the full solution
(a) 3 × 256 + 15 × 16 + 7 = 768 + 240 + 7 = 1015.
(b) 0..5000 is 5001 values. 2¹² = 4096 < 5001 ≤ 8192 = 2¹³ → 13 bits.
(c) 2¹³ − 1 = 8191.
GATE Traps
- k bits hold 2ᵏ values, but the largest value is 2ᵏ − 1.
- "From 0 to 5000" is 5001 values, not 5000.
- Group hex digits from the right (LSB end), not from the left.
Memory Hook
"One hex digit is one nibble": four bits, sixteen faces — 0 to F.
Connect the Dots
Binary numbers are how every field inside the network's wrappers will be stored. Next (0.2.3): networks also combine bit patterns — flipping, adding with a wrap-around, and dividing without carries. Those are the tools that will catch damaged bits in Phase 2.
Self-Test
- MCQ
0xA5 in binary is:
- 10100101
- 10101010
- 01011010
- 11000101
- NAT
Decimal value of 11110000?
Write your answer before opening the key.
- NAT
Minimum bits to give a different number to each of 1000 items?
Write your answer before opening the key.
- MSQ
Which are true for a 16-bit field?
- It has 65,536 possible values.
- Its largest value is 65,535.
- Its largest value in hex is 0xFFFF.
- It needs 4 hex digits plus one bit.
- NAT
Decimal value of 0x1F4?
Write your answer before opening the key.
Rule Card
- Binary places: 1, 2, 4, 8, 16, 32, 64, 128, …; MSB left, LSB right.
- Hex: one digit = 4 bits; A–F = 10–15; group from the right.
- k bits → 2ᵏ values, 0 … 2ᵏ − 1.
- Bits needed for N values = smallest k with 2ᵏ ≥ N.
- 2¹⁰ = 1024 · 2¹⁶ = 65,536 · 2²⁰ ≈ 1.05 M · 2³² ≈ 4.29 × 10⁹.
Concept Ledger
- binary
- decimal
- hexadecimal (hex), 0x prefix
- place value
- MSB / LSB
- nibble (4 bits)
- k bits give 2ᵏ values
- powers of 2
Answer Vault
Try the questions first. Open when you are ready to check.
Warm-up answers
- 2 × 1024 × 8 = 16,384.
- Mesh n(n − 1)/2, star n.
- From an encoding agreed in advance by sender and receiver.
Self-test answers
- A — A = 1010, 5 = 0101 → 10100101.
- B: That is 0xAA.
- C: That is 0x5A (digits swapped).
- D: That is 0xC5.
- 240 — 128 + 64 + 32 + 16 = 240.
- 10 — 2⁹ = 512 < 1000 ≤ 1024 = 2¹⁰ → 10 bits.
- ABC — 2¹⁶ = 65,536 values, 0 to 65,535 = 0xFFFF; 16 bits = exactly 4 hex digits.
- D: 16 bits = 4 × 4 bits = exactly 4 hex digits.
- 500 — 1 × 256 + 15 × 16 + 4 = 256 + 240 + 4 = 500.
Flashcards
- 0xFF in decimal?
Reveal answer
255. - Largest value of a k-bit field?
Reveal answer
2ᵏ − 1. - Bits for 0..5000?
Reveal answer
13 (5001 values ≤ 8192). - 2³²?
Reveal answer
4,294,967,296.
Exam shortcuts
- Binary ↔ hex: group bits in fours from the right; convert each group. — always (pad the leftmost group with zeros).
- Bits needed for N values = smallest k with 2ᵏ ≥ N. — counting values; remember 0..N is N + 1 values.