Forces / Logic gate lab
Logic gate lab
Wire up to 10 logic gates together — AND, OR, NOT, NAND, NOR, XOR and XNOR, every gate there is — drag each gate to exactly where you want it in the diagram, toggle the inputs, then press Check answer for a slow, fully-explained walk-through of exactly how the signal flows from input to output, one gate at a time. Every result is exact Boolean algebra: no approximation, no assumption.
Drag any gate in the diagram above to place it exactly where you want. Tap a gate type below to arm it, then press + Add gate (up to 10) — it appears wired to the earliest available inputs; change what feeds each pin using the small dropdown right next to it in the diagram (or the same controls listed again on the right). Removal only ever happens from the end (last gate or last input) — an earlier gate's output can't be pulled out from under a later gate that depends on it.
| Gate | Type | Input 1 | Input 2 | Output |
|---|
Seven gates, one exact rule each
Part of Forces — see the semiconductor explainer for how a transistor actually realises a logic gate, and Learn for where this fits in the class 12 syllabus.
Truth tables — all seven gates
The exact, complete definition of every gate — this is the whole of what "no assumptions" means here: the lab just applies these tables, in order, to whatever you build.
AND
| A | B | Y |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
OR
| A | B | Y |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 1 |
NOT
| A | Y |
|---|---|
| 0 | 1 |
| 1 | 0 |
NAND
| A | B | Y |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
NOR
| A | B | Y |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 0 |
XOR
| A | B | Y |
|---|---|---|
| 0 | 0 | 0 |
| 0 | 1 | 1 |
| 1 | 0 | 1 |
| 1 | 1 | 0 |
XNOR
| A | B | Y |
|---|---|---|
| 0 | 0 | 1 |
| 0 | 1 | 0 |
| 1 | 0 | 0 |
| 1 | 1 | 1 |
JEE & NEET-style practice questions
Ten conceptual questions in the style of what shows up in JEE and NEET-level physics on logic gates — tap a question to reveal the answer.
Which gates are called universal gates, and why?
NAND and NOR are called universal gates because either one, used by itself, can be used to build every other basic gate — AND, OR and NOT. For example, tying both inputs of a NAND gate together turns it into a NOT gate, since NAND(A,A) = NOT(A AND A) = NOT(A). Try the "NAND from AND+NOT" preset above and compare it to a plain NAND gate on the same inputs — they always agree.
What is the output of a NAND gate when both inputs are LOW (0)?
1. A NAND gate outputs 0 only in the single case where both inputs are 1 (HIGH); for every other input combination, including both inputs 0, it outputs 1.
State De Morgan's first theorem and its logic-gate equivalent.
De Morgan's first theorem: (A·B)′ = A′ + B′ — the complement of an AND is the OR of the complements. In gates, this means a NAND gate (AND then NOT) is logically identical to an OR gate fed by two inverted inputs: NAND(A,B) = OR(NOT A, NOT B).
How do you realize the OR operation using only NAND gates?
Use three NAND gates: feed A into a NAND gate with both its inputs tied to A (this gives NOT A), do the same for B to get NOT B, then feed NOT A and NOT B into a third NAND gate. By De Morgan's theorem, NAND(NOT A, NOT B) = A OR B.
Why is XOR sometimes called an "inequality detector"?
Because its output is 1 only when its two inputs are different (one 0 and one 1) and 0 whenever they match. This makes it useful for comparing two bits, for parity checking, and as the SUM output of a half adder.
In a half adder, what are the Boolean expressions for SUM and CARRY?
SUM = A XOR B, and CARRY = A AND B. The half adder is the simplest binary adding circuit and a classic example of combining basic gates into a useful building block — try the "Half adder (SUM)" preset above.
What is another name for a NOT gate, and how can it be built from a NAND gate?
A NOT gate is also called an inverter. It can be built from a NAND gate by tying both of the NAND gate's inputs to the same signal: NAND(A,A) = NOT(A AND A) = NOT(A).
What is the truth-table output sequence of a 2-input XNOR gate for (0,0), (0,1), (1,0), (1,1)?
1, 0, 0, 1. XNOR outputs 1 exactly when its two inputs match (both 0 or both 1), and 0 when they differ.
If a NOR gate has both inputs HIGH, what is the output, and why?
0. NOR is the complement of OR, and OR(1,1) = 1, so NOR(1,1) = NOT(1) = 0. A NOR gate only outputs 1 when both of its inputs are 0.
Two NOT gates are connected in series with input A. What is the final output?
A itself. NOT(NOT(A)) = A — inverting a signal twice always returns the original signal, a property called double negation. Try the "Double NOT" preset above.
Test yourself
Pick Class 12 in the physics quiz to test yourself on logic gates and digital electronics — 10 random questions, with an explanation for every answer.
Take the physics quiz →