OCR GCSE Computer Science revision notes
Boolean logic Revision Notes
Study Boolean logic with curriculum-aligned Revision Notes resources, practice links, and exam-focused support.
At a glance
revision notes
Resource type
Topic
Boolean logic
Revision notes
Understanding Boolean Logic Revision Notes
Core Boolean Operators
Boolean logic uses three primary operators: AND, OR, and NOT. The AND operator (·) returns true (1) only if all its inputs are true. The OR operator (+) returns true (1) if at least one of its inputs is true. The NOT operator (') inverts its single input, turning true (1) into false (0) and false (0) into true (1). These operators are the building blocks for all complex logical expressions and form the basis of digital circuit design.
Truth Tables
A truth table is a mathematical table used in Boolean algebra to compute the functional values of logical expressions. It lists all possible input combinations for a given logical circuit or expression and shows the corresponding output for each combination. For an AND gate with two inputs, there are four possible combinations (00, 01, 10, 11) and only one results in a true (1) output (11). Truth tables are essential for analysing and designing logic circuits, helping to predict their behavior under different input conditions.
Logic Gates and Diagrams
Logic gates are the basic building blocks of any digital system. They are electronic circuits that take one or more binary inputs and produce a single binary output. Each gate implements a Boolean logic operator (e.g., AND gate, OR gate, NOT gate). Logic diagrams use standard graphical symbols to represent these gates and show how they are interconnected to form digital circuits. Understanding these diagrams is vital for interpreting and designing digital hardware, from simple circuits to complex CPUs. More complex gates like NAND, NOR, XOR, and XNOR are also derived from these basic operators.
Applying Boolean Logic in Programming
In programming, Boolean logic is fundamental for controlling program flow and making decisions. Conditional statements (e.g.,
if A AND B,while C OR D) rely heavily on Boolean expressions. For instance, a program might proceed onlyif username_correct AND password_correct. Database queries also utilize Boolean operators to filter data, such asSELECT * FROM users WHERE age > 18 AND city = 'London'. Evaluating these expressions determines which code blocks are executed, making Boolean logic indispensable for creating dynamic and responsive software.
Related topics
Study nearby topics next
Revision hubs
