Boolean logic and binary are the foundation of how computers store data, make decisions, and process instructions. This cheat sheet helps students connect true or false statements with the 1s and 0s used inside digital systems. It is useful for programming, circuits, algorithms, and understanding how low-level computing works.
Students need these ideas to read conditions, simplify logic, and work confidently with different number bases.
The core ideas include Boolean operators such as AND, OR, and NOT, along with truth tables that show every possible input and output. Binary numbers use powers of 2, so each bit position has a place value such as 1, 2, 4, 8, and 16. Base conversion uses repeated division, place-value expansion, or grouping bits into hexadecimal digits.
Binary addition follows normal carrying rules, but each column can only contain 0 or 1.
Key Facts
- In Boolean logic, true is usually represented by 1 and false is usually represented by 0.
- The AND operator is true only when both inputs are true, so A AND B = 1 only if A = 1 and B = 1.
- The OR operator is true when at least one input is true, so A OR B = 1 if A = 1 or B = 1 or both are 1.
- The NOT operator flips a value, so NOT 1 = 0 and NOT 0 = 1.
- Binary place values are powers of 2, so 1011 in base 2 = 1x8 + 0x4 + 1x2 + 1x1 = 11 in base 10.
- To convert decimal to binary, divide by 2 repeatedly and read the remainders from bottom to top.
- Binary addition rules are 0 + 0 = 0, 0 + 1 = 1, 1 + 1 = 10, and 1 + 1 + 1 = 11.
- Four binary bits match one hexadecimal digit, so 1111 in base 2 = F in base 16.
Vocabulary
- Bit
- A bit is the smallest unit of digital data and can have the value 0 or 1.
- Boolean expression
- A Boolean expression is a statement that evaluates to either true or false.
- Truth table
- A truth table lists every possible input combination and the output for a Boolean expression.
- Logic gate
- A logic gate is a circuit symbol or operation that produces an output from Boolean inputs.
- Byte
- A byte is a group of 8 bits often used to store one character or small integer value.
- Hexadecimal
- Hexadecimal is a base-16 number system that uses digits 0 through 9 and letters A through F.
Common Mistakes to Avoid
- Treating 10 in binary as ten: 10 in base 2 equals 2 in base 10 because the left digit is the 2s place.
- Forgetting that AND requires both inputs to be true: A AND B is 0 if either input is 0, even when the other input is 1.
- Confusing OR with exclusive OR: normal OR is true when one or both inputs are true, while XOR is true only when the inputs are different.
- Reading decimal-to-binary remainders in the wrong order: the remainders must be read from bottom to top after repeated division by 2.
- Ignoring carries in binary addition: 1 + 1 is not 2 as a single digit, it becomes 10 with a carry to the next column.
Practice Questions
- 1 Convert 110101 in base 2 to base 10.
- 2 Convert 45 in base 10 to binary.
- 3 Add the binary numbers 1011 and 0110.
- 4 Explain why computers can represent both logic decisions and numerical data using only 0s and 1s.
Understanding Boolean Logic & Binary
A Boolean expression is a compact rule for making a choice. In a program, the inputs may come from a keyboard, a sensor, a saved record, or a calculation. A school login system might allow access only when a username is valid and a password is valid.
A thermostat might switch heating on when the room is cold or when a frost safety setting is active. The same type of rule can be built from electronic logic gates.
A gate receives voltage signals that represent two possible states, then produces one output signal. Many small gates linked together can perform comparisons, select data, or control parts of a processor.
Truth tables matter because they test every possible case. With two inputs, there are four input combinations. With three inputs, there are eight.
Listing cases prevents a common programming error where a condition works for ordinary inputs but fails at an edge case. Pay close attention to words such as both, either, at least one, and only if. These words tell you which operator fits.
Parentheses matter too. A condition with several operators can mean different things depending on the order of evaluation. Writing intermediate results in separate columns is often clearer than trying to evaluate a long expression in one step.
Some logic operations are especially useful in computing beyond simple decisions. Exclusive OR is true when the two inputs differ. It is used in binary addition and in simple error checks.
Bitwise operations apply a rule to matching bit positions in whole numbers. A bitwise AND can test whether a particular feature flag is enabled. A bitwise OR can turn on selected flags without changing others.
A bitwise NOT reverses every bit within a chosen bit width. This is why the number of bits must be known. Reversing eight bits gives a different result from reversing sixteen bits.
Binary is not only a way to write numbers. It is a practical format for storing many kinds of data. Text characters have binary codes.
A digital image stores colour values as binary numbers. Audio recordings store measurements of sound at regular times. A computer does not treat these bit patterns as meaningful by themselves.
The program reading the data decides whether a pattern represents a number, a letter, a colour, or part of an instruction. This is why file formats and data types matter. The same sequence of bits can be interpreted in several ways.
When working with binary arithmetic, track carries carefully from right to left. A carry is not an extra decoration. It changes the value of the next column.
Fixed-size binary values have limits. An unsigned eight-bit value can represent values from zero through 255. Adding beyond that range causes overflow, where the stored result wraps around unless the system uses more bits or detects the error.
Signed integers need another rule because they must represent negative values. Many computers use two's complement, where the leftmost bit helps indicate sign. Students should first become secure with place value and carries, then learn how bit width, overflow, and signed representation affect real programs.