PyGCSE Python Lab

Logic Gate Simulator

Explore all six logic gates (AND, OR, NOT, XOR, NAND, NOR) with interactive inputs, truth tables, and compound expression building. Matches AQA A Level CS (7517) specification §4.6.4.

📖 Learn Step-by-Step

Select a gate to see its symbol, truth table, and test it with interactive inputs.

A AND B

AND gate

Output is 1 only when ALL inputs are 1.

Q0

Truth Table

ABQ
000
010
100
111

Logic Gate Practice Questions

Q1

An AND gate has inputs A=1 and B=0. What is the output?

0/1 mark
Q2

A NAND gate has inputs A=1 and B=1. What is the output?

0/1 mark
Q3

How many rows are in a truth table for a circuit with 3 inputs?

0/1 mark
Q4

A circuit implements Q = NOT(A OR B). When A=0 and B=0, what is Q?

0/2 marks
Q5

A XOR gate has inputs A=1 and B=1. What is the output?

0/1 mark
Quick reference — logic gate summary
GateSymbolInputsOutput = 1 when…
AND2All inputs are 1
OR2Any input is 1
NOT¬1Input is 0 (inverts)
XOR2Inputs are different
NAND2NOT all inputs are 1
NOR2All inputs are 0