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. /From a logic expression to a circuit and back

Course 10.3·Lesson 1 of 3

From a logic expression to a circuit and back

A logic expression and a logic circuit say the same thing in two ways. You learn to draw the circuit for an expression, one gate for each operator, exactly as it is written. Then you read a circuit back into an expression, starting from the output.

about 25 min1 simulation1 practice question
Lesson 1 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.

One rule, two ways to write it

In the last two courses you met the six gates. Now we join them into bigger circuits. A circuit in this syllabus has at most three inputs and one output.

A logic expression such as X = (A AND B) OR (NOT C) is the rule in words. A logic circuit is the same rule drawn with gate symbols. You must be able to go from one to the other.

From an expression to a circuit

Follow these steps.

  1. Write the inputs down the left side: A, then B, then C.
  2. One gate for each operator. Every AND, OR, NAND, NOR, XOR and NOT in the expression is one gate. (A AND B) OR (NOT C) has three operators, so three gates.
  3. Brackets first. The gates inside brackets take the inputs. Their outputs feed the gate outside the brackets.
  4. The last operator is the output gate. Here it is the OR, whose output is X.
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 an AND gate; C goes into a NOT gate; the output of the AND gate and the output of the NOT gate go into an OR gate, whose output is X. The output of the first gate is labelled P and the output of the second gate Q.

The AND gate takes A and B, and its output is P. The NOT gate takes C, and its output is Q. The OR gate takes P and Q.

Draw what you are given. The syllabus says circuits must be drawn for the statement given, without simplification. If the expression has a NOT and an AND, draw both, even if you know one NAND gate would do. Every gate except NOT has exactly two inputs, so A AND B AND C is drawn as two AND gates.

One input, two gates. An input can feed more than one gate. The wire then splits, and a dot marks the split. Where two wires cross with no dot, they are not joined.

From a circuit to an expression

Start at the output and work back.

  1. Write the output gate: X = ... XOR ....
  2. For each input of that gate, write the gate that feeds it, in brackets.
  3. Keep going until you reach A, B and 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.

Here A and B go into a NAND gate (P). B and C go into an OR gate (Q). P and Q go into an XOR gate. Working back from the output gives X = (A NAND B) XOR (B OR C). Notice that B feeds two gates. The dot shows where its wire splits.

Practise with new numbers

Try it in Python

The program works out X = (A AND B) OR (NOT C) one gate at a time, like reading the circuit from left to right. It also counts the gates from the expression.

Read it first. Then run it. Which gate decides the output for these inputs?

1. Change the inputs to A, B, C = 1, 1, 1. Predict P, Q and X.

2. Change expression to "(A OR B) AND (NOT C)". Does the count of gates change?

Common mistakes

  • Simplifying the circuit. Draw every gate the expression names, in the same order.
  • A three-input gate. Use two two-input gates instead.
  • Brackets ignored. (A AND B) OR C and A AND (B OR C) are different circuits.
  • A split wire with no dot. Without the dot, the examiner reads two crossing wires.

Remember these

  • One gate for each operator, NOT included.
  • Brackets are worked out first. The last operator is the output gate.
  • Read a circuit from the output back to the inputs.
  • Draw exactly what is given, without simplifying.

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 gates does the circuit for X = (A OR B) AND (NOT C) have?
  1. In X = (A OR B) AND (NOT C), which gate gives the output X?
  1. A circuit has A and B going into a NOR gate, and its output and C going into an AND gate. Write the expression.
  1. How many gates do you need for X = A OR B OR C?
  1. What does a dot on a wire mean?

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)

You are asked to draw the logic circuit for X = (A OR B) AND (NOT C), exactly as written…Easy · High School (9–10) · by StemPy Lab
Mo copies a circuit from a textbook page and describes it in words: A goes into a NOT gate; B and C…Medium · High School (9–10) · by StemPy Lab
A student must draw the circuit for X = NOT ((A AND B) OR C)…Hard · High School (9–10) · by StemPy Lab
Next: lesson 2Truth tables for three inputs
← Logic Circuits, Logic Expressions and Truth Tables
← PreviousTruth tables for three inputs →

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.