Number Systems and Boolean Logic
Number Systems and Boolean Logic tests positional number systems, conversion, binary arithmetic, complements, logic gates, truth tables and Boolean simplification.
Core rules
A number system with base r uses digits 0 to r−1 and place values r^n. Binary (base 2), octal (8), decimal (10) and hexadecimal (16) are examinable. To convert decimal to another base, divide repeatedly by the target base and read remainders upwards. To convert binary to hex, group bits in fours from the right; to octal, group in threes. The 2's complement of an n-bit number is 2^n − number, obtained by inverting bits and adding 1; it represents negative numbers and turns subtraction into addition. Basic gates are AND, OR, NOT, NAND, NOR, XOR and XNOR. Boolean laws include identity, idempotent, complement, distributive, absorption and De Morgan's theorems: (A·B)' = A' + B' and (A+B)' = A'·B'.
Worked example
Convert decimal 156 to binary and hexadecimal. Dividing 156 by 2 gives remainders 0,0,1,1,1,0,0,1 read upwards: 10011100₂. Group into fours: 1001 1100 = 9C₁₆. Check: 9 × 16 + 12 = 144 + 12 = 156. The grouping works because each hex digit represents exactly four binary bits.
Traps
Read remainders from bottom to top, not top to bottom. In De Morgan's theorem, change the operator and complement each term; do not drop parentheses. XOR gives 1 only when inputs differ; OR gives 1 when at least one input is 1. In 2's complement, the sign bit has weight −2^(n−1), not +2^(n−1).