🌐 1. Why Computers Use Binary
Key Idea
- Computers use binary (base 2) because their hardware is built from electronic circuits (logic gates).
- These circuits have two stable states:
- ON (1)
- OFF (0)
Why Binary?
- Reliable (only 2 states → less error)
- Easy to represent electronically
- Works directly with logic gates and registers
Important Points
- All data is converted into binary:
- Text → ASCII/Unicode
- Images → pixel values
- Sound → digital signals
📌 Exam Tip:
Always mention “two-state system (on/off)” and “logic gates” when explaining why binary is used.
🔢 2. Number Systems
(a) Understanding the Systems
| System | Base | Digits Used |
|---|---|---|
| Denary | 10 | 0–9 |
| Binary | 2 | 0, 1 |
| Hexadecimal | 16 | 0–9, A–F (A=10, F=15) |
(b) Conversions
(i) Denary → Binary
Method: Divide by 2 repeatedly
Example: Convert 13 to binary
| Division | Quotient | Remainder |
|---|---|---|
| 13 ÷ 2 | 6 | 1 |
| 6 ÷ 2 | 3 | 0 |
| 3 ÷ 2 | 1 | 1 |
| 1 ÷ 2 | 0 | 1 |
Read bottom to top → 1101
Binary → Denary
Use place values
Example: 1101
(ii) Denary → Hexadecimal
Divide by 16
Example: Convert 26
| Division | Quotient | Remainder |
|---|---|---|
| 26 ÷ 16 | 1 | 10 (A) |
| 1 ÷ 16 | 0 | 1 |
Answer: 1A
Hexadecimal → Denary
Example: 1A
(iii) Binary ↔ Hexadecimal
Group into 4 bits (nibbles)
Example: Binary → Hex
10101100 → 1010 1100
= A C → AC
Example: Hex → Binary
7F →
7 = 0111
F = 1111
→ 01111111
📌 Exam Tip:
Always group binary in 4-bit chunks from the right.
💡 3. Why Hexadecimal is Used
Advantages
- Shorter than binary
- Easier for humans to read
- Direct conversion to/from binary
Where It’s Used
- Memory addresses
- Machine code
- HTML colour codes (e.g. #FF5733)
- Debugging
📌 Exam Tip:
Say: “Hexadecimal is a compact representation of binary.”
➕ 4. Binary Addition (8-bit)
Rules
- 0 + 0 = 0
- 0 + 1 = 1
- 1 + 1 = 10 (carry 1)
Example
01001010 (74)
+ 00110101 (53)
------------
01111111 (127)
Overflow
Definition
- Occurs when result exceeds 8-bit limit (255)
Example
11111111 (255)
+00000001 (1)
------------
100000000 (9 bits → overflow)
Why it happens
- Register has fixed size
- Cannot store values beyond its limit
📌 Exam Tip:
Always mention:
- “exceeds 255”
- “register size exceeded”
🔁 5. Logical Binary Shifts
Left Shift (<<)
- Moves bits left
- Adds 0 on right
- Multiplies by 2
Example:
00000101 (5)
→ 00001010 (10)
Right Shift (>>)
- Moves bits right
- Adds 0 on left
- Divides by 2
Example:
00001010 (10)
→ 00000101 (5)
Important Rules
- Bits shifted out are lost
- Zeros are added at the opposite end
- MSB = leftmost bit
- LSB = rightmost bit
Multiple Shifts
Each shift = ×2 or ÷2
Example:
00000011 (3)
<< 2 → 00001100 (12)
📌 Exam Tip:
State:
- “bits lost”
- “zeros inserted”
- “value multiplied/divided”
➖ 6. Two’s Complement (8-bit)
Used to represent negative numbers
Range of 8-bit Two’s Complement
- -128 to +127
Converting Positive to Two’s Complement
Just write normal binary:
Example: +5
= 00000101
Converting Negative Numbers
Steps:
- Write positive binary
- Invert bits
- Add 1
Example: -5
- +5 = 00000101
- Invert → 11111010
- Add 1 → 11111011
Converting Back to Denary
Example: 11111011
- Invert → 00000100
- Add 1 → 00000101 = 5
→ Answer = -5
📌 Exam Tip:
Always show:
- inversion step
- +1 step
⚠️ Key Definitions
- Bit: Binary digit (0 or 1)
- Byte: 8 bits
- MSB: Most Significant Bit (leftmost)
- LSB: Least Significant Bit (rightmost)
- Overflow: Result exceeds storage capacity
- Register: Temporary storage in CPU
📝 Common Exam Mistakes
❌ Forgetting to:
- Group binary correctly for hex
- Show working steps
- Use 8 bits when required
- Add carry in binary addition
- Add 1 in two’s complement
🧠 Quick Summary
- Binary = base 2 → used by computers
- Denary = base 10 → used by humans
- Hex = base 16 → compact binary
- Shifts = ×2 or ÷2
- Overflow = >255 (8-bit)
- Two’s complement = negative numbers