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
Logic Circuits, Logic Expressions and Truth Tables
  1. 1From a logic expression to a circuit and back
  2. 2Truth tables for three inputs
  3. 3From a problem statement or a truth table to a circuit
  1. Computer Science
  2. /Logic Circuits, Logic Expressions and Truth Tables
  3. /Truth tables for three inputs

Course 10.3·Lesson 2 of 3

Truth tables for three inputs

With three inputs a truth table has eight rows. You fill them in binary order, add working columns for the gates inside the circuit, and check the output column. This is the most common logic question on the examination paper.

about 25 min1 simulation1 practice question
Lesson 2 of 3Show all lessonsHide
Logic Circuits, Logic Expressions and Truth Tables
  1. 1From a logic expression to a circuit and back
  2. 2Truth tables for three inputs
  3. 3From a problem statement or a truth table to a circuit

Try the code and the simulations beside the lesson.

Eight rows

Each input can be 0 or 1. With three inputs there are 2×2×2=82 \times 2 \times 2 = 82×2×2=8 combinations. The syllabus prints the table like this, and you should use the same order every time.

A B COutput
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

Look at the pattern. A is 0 in the top four rows and 1 in the bottom four. B changes every two rows. C changes every row. The rows are the binary numbers from 0 to 7.

Working columns

For a circuit with gates inside, add a column for the output of each inner gate. Then the output gate only has to look at those columns.

Let us complete the table for the circuit of the last lesson, X = (A NAND B) XOR (B OR C).

A logic circuit drawn with the standard gate symbols. Inputs A, B and C are on the left and the output X is on the right. A and B go into a NAND gate; B and C go into an OR gate; the output of the NAND gate and the output of the OR gate go into an XOR gate, whose output is X. The output of the first gate is labelled P and the output of the second gate Q. Input B feeds two gates, and a dot marks where its wire splits.
  • P = A NAND B is 0 only when A and B are both 1.
  • Q = B OR C is 0 only when B and C are both 0.
  • X = P XOR Q is 1 when P and Q differ.
A B CP QX = P XOR Q
0 0 01 01
0 0 11 10
0 1 01 10
0 1 11 10
1 0 01 01
1 0 11 10
1 1 00 11
1 1 10 11

The output column is 1, 0, 0, 0, 1, 0, 1, 1. It has 4 ones.

Check one row by hand. Take 1 1 0. P = 1 NAND 1 = 0. Q = 1 OR 0 = 1. X = 0 XOR 1 = 1. That matches the table.

From an expression or a circuit

The method is the same whether the question gives an expression or a drawing. With a drawing, first write the expression from the output back, as in the last lesson. Then name the inner gates P and Q and fill their columns.

Shortcuts that check your work

  • If the output gate is AND, X can only be 1 where both working columns are 1.
  • If the output gate is OR, X is 1 wherever either working column is 1.
  • A NOT on one input flips that input's column. Write it as its own column.

Practise with new numbers

Try it in Python

The program uses three loops inside each other, so the rows come out in binary order. It prints P, Q and X, and counts the ones.

Read it first. Then run it. Does every row match the table above?

1. Change the output gate to AND: write x = 1 if p == 1 and q == 1 else 0. How many ones now?

2. Swap the loops so that c is the outer loop. Why is the order of the rows now different from the syllabus order?

Common mistakes

  • Seven or nine rows. Three inputs always give exactly 8 rows.
  • Rows out of order. The marks are for the outputs in the given rows. Keep to binary order.
  • No working columns. Two gates in your head at once is where slips happen.
  • Reading the wrong input. B often feeds two gates. Use the B column for both.

Remember these

  • Three inputs give 8 rows: 0 0 0 up to 1 1 1.
  • Add a working column for each inner gate.
  • Check one or two rows by hand at the end.

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 of a three-input table have A = 1?
  1. What is the fifth row of a three-input table?
  1. For X = (A NAND B) XOR (B OR C), find X in the row 0 0 0.
  1. For X = (A AND B) OR C, how many rows give X = 1?
  1. Why do we write P and Q columns?

References

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

Enroll free in Logic Circuits, Logic Expressions 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 (3)

A garage door opens only if the master switch A is on and at least one of two remote controls, B or…Easy · High School (9–10) · by StemPy Lab
An irrigation valve opens on the rule X = (A XOR B) OR (NOT C), where C = 1 means it is raining…Medium · High School (9–10) · by StemPy Lab
A traffic-light controller contains the circuit drawn below…Hard · High School (9–10) · by StemPy Lab
Next: lesson 3From a problem statement or a truth table to a circuit
← Logic Circuits, Logic Expressions and Truth Tables
← From a logic expression to a circuit and backFrom a problem statement or a truth table to a circuit →

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.

Python Labs (1)

A three-input truth tablePython Lab · by StemPy Lab