HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
NAND, NOR and XOR Gates and Truth Tables
  1. 1The NAND and NOR gates
  2. 2The XOR gate
  3. 3Completing truth tables
  1. Computer Science
  2. /NAND, NOR and XOR Gates and Truth Tables
  3. /Completing truth tables

Course 10.2·Lesson 3 of 3

Completing truth tables

A truth table must have every row, in the right order, with the right outputs. This lesson gives a method that never misses a row, uses working columns for each gate, and shows how to name a gate from its output column alone.

about 25 min1 simulation1 practice question
Lesson 3 of 3Show all lessonsHide
NAND, NOR and XOR Gates and Truth Tables
  1. 1The NAND and NOR gates
  2. 2The XOR gate
  3. 3Completing truth tables

Try the code and the simulations beside the lesson.

A method that never misses a row

A truth table lists every combination of the inputs. Follow these steps every time.

  1. Count the rows. One input gives 2 rows. Two inputs give 4. Three inputs give 8. Each new input doubles the number.
  2. Fill the inputs in binary order. Count up from 0 in binary. With three inputs the rows are 0 0 0, 0 0 1, 0 1 0, 0 1 1, 1 0 0, 1 0 1, 1 1 0 and 1 1 1.
  3. Add a working column for each gate. Work out the first gate in every row. Then the next gate.
  4. Fill in the output. Check one or two rows again by hand.

A quick check on the inputs: in the column of the first input, the top half is all 0 and the bottom half is all 1. In the last input, the values take turns: 0, 1, 0, 1.

Working columns

Let us complete the table for X = (A NAND B) AND (A OR B). Call the NAND output P and the OR output Q. To fit a phone screen, both working values sit in one column.

A BP QX = P AND Q
0 01 00
0 11 11
1 01 11
1 10 10

The output column is 0, 1, 1, 0. That is the XOR column! The circuit uses three gates to do the job of one XOR gate.

Naming a gate from its column

Sometimes a question gives the output column and asks which gate it is. Learn the five two-input columns, with the rows in the order 0 0, 0 1, 1 0, 1 1:

  • AND: 0, 0, 0, 1
  • OR: 0, 1, 1, 1
  • NAND: 1, 1, 1, 0
  • NOR: 1, 0, 0, 0
  • XOR: 0, 1, 1, 0

Count the 1s first. AND and NOR have one 1 each. OR and NAND have three. XOR has two. Then look at where they are. AND has its 1 at the bottom, in the row 1 1. NOR has its 1 at the top, in the row 0 0.

Practise with new numbers

Try it in Python

The program stores the five two-input gates in a dictionary. It prints each output column, then finds the gate that gives a mystery column.

Read it first. Then run it. Which gate is the mystery gate?

1. Change mystery to [0, 1, 1, 0]. Predict the answer, then run it.

2. Change it to [1, 0, 1, 0]. Why is no gate printed?

Common mistakes

  • Rows in a different order. Your answer may be right but hard to mark. Always count up in binary.
  • A missing row. Count the rows before you start: 4 for two inputs, 8 for three.
  • No working columns. Doing two gates in your head at once causes most slips.
  • Naming a gate from one row. Check the whole column. AND and NOR both have one 1, in different rows.

Remember these

  • The number of rows is 2 for one input, 4 for two and 8 for three.
  • Fill the inputs by counting up in binary.
  • Add a working column for each gate before the output.
  • Count the 1s in a column, then look at where they are, to name the gate.

Check yourself

Try each one on your own first. If you are stuck, open a hint. Then check with Show the answer.

  1. How many rows does a truth table with three inputs have?
  1. With three inputs A, B and C, which row comes straight after 0 1 1?
  1. A gate has the output column 1, 0, 0, 0. Which gate is it?
  1. A gate has the output column 1, 1, 1, 0. Which gate is it?
  1. Why is it a good idea to add a working column for each gate?

References

  • Cambridge International, IGCSE Computer Science 0478 syllabus for 2026, 2027 and 2028, topic 10 Boolean logic, and section 4, Logic gate symbols.

Enroll free in NAND, NOR and XOR Gates and Truth Tables

Every lesson is open to read. Enrolling also lets you:

  • Mark lessons done and carry on where you stopped.
  • Take the tests of this lesson and its course.
  • Count the course towards the certificate for its chapter.
No payment. You can leave at any time.

Problems (4)

A gate has two inputs. Its output column, in the rows 0 0, 0 1, 1 0, 1 1, is 1, 0, 0, 0…Easy · High School (9–10) · by StemPy Lab
Complete the truth table for X = (A NOR B) OR (A AND B)…Medium · High School (9–10) · by StemPy Lab
A circuit has three inputs. A and B go into a NOR gate…Hard · High School (9–10) · by StemPy Lab
That was the last lessonBack to the course: take the test
← NAND, NOR and XOR Gates and Truth Tables
← The XOR gateNext →

Discussion (0)

Log in to join the discussion.

Loading…

1 Python program
5 questions to check yourself

This lesson is free to read. Enroll free to keep your place and take the tests.

Leo's homework gives this column for X = (A XOR B) AND C, reading the patterns 0 0 0 to 1 1 1 from…Hard · High School (9–10) · by StemPy Lab

Python Labs (1)

Name the gate from its columnPython Lab · by StemPy Lab

Question Sets (1)

NAND, NOR, XOR and Truth Tables: Concept Check10 questions · by StemPy Lab

Notes (1)

NAND, NOR and XOR Gates: Quick RevisionNote · by StemPy Lab