What's covered
Key facts
AND, OR, NOT — Meaning
An AND gate's output is true only when both inputs are true.
Boolean Logic in Programming
IF age >= 18 AND has_ticket runs the body only when both conditions are true.
Logic Gates and Circuits
An AND gate outputs 1 only when all inputs are 1.
Truth Tables
For A=1, B=0, the value of A AND (NOT B) is 1 AND 1 = 1 (true).
AND, OR, NOT — Meaning
true AND (false OR true) = true AND true = true.
Boolean Logic in Programming
With x = 5, the expression (x > 0) and (x < 10) evaluates to true (both conditions hold).
Logic Gates and Circuits
A logic gate is a piece of hardware that performs a Boolean operation on its input(s).
Truth Tables
When both inputs of AND are 1, the output is 1 (true).
AND, OR, NOT — Meaning
true AND false = false.
Boolean Logic in Programming
Booleans are used in IF statements — the condition is evaluated as either true or false.
Sample questions
A taste of the 36 questions in this topic, answers marked. Sign up to practise the full set with spaced repetition.
When is an AND gate's output true?
- •When at least one input is true
- ✓When both inputs are true
- •When neither input is true
- •When the inputs are different values
How are Booleans used in IF statements?
- ✓Conditions evaluate true or false
- •Functions return integer values only
- •Loops count how many times code runs
- •Variables store numbers as text strings
What is a logic gate?
- •A circuit that converts analogue signals to digital
- •A memory chip storing binary values
- ✓Hardware doing a Boolean operation
- •Software that filters network traffic
Rows in an AND truth table with two inputs?
- •Eight rows in total
- ✓Four rows in total
- •Six rows in total
- •Two rows in total
When is an OR gate's output true?
- •Only when both inputs are false
- •Only when both inputs are true
- ✓When any input is true
- •When the two inputs have opposite values
IF age >= 18 AND has_ticket — when does it run?
- ✓Only when both are true
- •When either is true (one needed)
- •When neither is true (zero needed)
- •When the age is below 18 only
Try it for four weeks. Free.
One school. Unlimited classes. No card limit. No teacher limit. If your students aren't practising daily by the end of the trial, you owe us nothing.