Day 2
Day 2
Number Systems:
o Binary (Base-2): Uses 0 and 1. Example: 1010 (Binary) = 10 (Decimal)
o Octal (Base-8): Uses digits 0–7. Example: 17 (Octal) = 15 (Decimal)
o Decimal (Base-10): Common number system, uses 0–9.
o Hexadecimal (Base-16): Uses 0–9 and A–F. Example: 1F (Hex) = 31 (Decimal)
Conversions:
o Binary to Decimal: Multiply each bit by 2^position and add.
Example: 1101 = 1×2³ + 1×2² + 0×2¹ + 1×2⁰ = 8 + 4 + 0 + 1 = 13
o Decimal to Binary: Divide by 2 repeatedly and reverse the result.
Example: 13 → 1101 (13 ÷ 2 = 6 R1, 6 ÷ 2 = 3 R0, 3 ÷ 2 = 1 R1, 1 ÷ 2 = 0
R1 → 1101)
o Hex to Binary: Replace each hex digit with its 4-bit binary equivalent.
Example: A9 = 1010 1001
o Binary to Hex: Group 4 bits from right to left and convert each group.
Example: 10101001 → A9
1's and 2's Complement:
o 1's Complement: Flip the bits (0→1, 1→0)
Example: 1010 → 0101
o 2's Complement: Add 1 to 1's complement
Example: 0101 + 1 = 0110
Used to represent negative binary numbers
Boolean Algebra & Logic Gates:
o Basic Logic Gates:
AND: A·B → True only if both A and B are 1
OR: A + B → True if any input is 1
NOT: ¬A → Inverts the input
o Universal Gates:
NAND: NOT of AND
NOR: NOT of OR
A B Sum Carry
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
o Full Adder:
Truth Table:
Diagrams: You can easily find visual diagrams for logic gates and adders online. Let me know if
you’d like embedded diagrams or hand-drawn versions.