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
NOT, AND and OR Gates
  1. 1Logic gates and the NOT gate
  2. 2The AND gate
  3. 3The OR gate and joining two gates
  1. Computer Science
  2. /NOT, AND and OR Gates
  3. /The OR gate and joining two gates

Course 10.1·Lesson 3 of 3

The OR gate and joining two gates

An OR gate gives 1 when at least one input is 1. You learn its symbol and truth table, and then join two gates into a small circuit. A middle column in the truth table holds the output of the first gate, so you can work out the circuit one gate at a time.

about 25 min1 simulation1 practice question1 Python program5 questions to check yourself

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

Lesson 3 of 3Show all lessonsHide
NOT, AND and OR Gates
  1. 1Logic gates and the NOT gate
  2. 2The AND gate
  3. 3The OR gate and joining two gates

Try the code and the simulations beside the lesson.

At least one

A car beeps when the driver's door is open or the seat belt is not fastened. Either one is enough to start the beep. Both together also make it beep. That is the rule of the OR gate.

The OR gate

The OR gate gives 1 when input A is 1, or input B is 1, or both are 1. It gives 0 only when both inputs are 0.

A BX = A OR B
0 00
0 11
1 01
1 11

The logic expression is X = A OR B. The symbol has a curved back and a pointed front. Compare it with AND: AND has a flat back.

Both counts. In everyday speech, "tea or coffee" often means one but not both. In logic, OR includes the row where both inputs are 1. The gate that leaves out that row is XOR, in the next course.

Joining two gates

A logic circuit joins gates together. The output of one gate becomes an input of the next. Here is a circuit with two gates. B goes into a NOT gate. Its output and A go into an OR gate, whose output is X.

A logic circuit drawn with the standard gate symbols. Inputs A and B are on the left and the output X is on the right. B goes into a NOT gate; A and the output of the NOT gate go into an OR gate, whose output is X. The output of the NOT gate is labelled P.

We call the output of the NOT gate P. The circuit is X = A OR (NOT B). The brackets show that NOT B is worked out first.

To fill in the truth table, add a middle column for P. Work out P in every row first. Then use A and P to find X.

A BP = NOT BX = A OR P
0 011
0 100
1 011
1 101

Check one row. In the row A = 0, B = 1, we get P = NOT 1 = 0, and X = 0 OR 0 = 0. That is the only row where X is 0.

From a problem to a circuit

An example. A door alarm sounds when the door is open (D = 1) and the system is not switched off (S = 0). The alarm is X = D AND (NOT S).

A logic circuit drawn with the standard gate symbols. Inputs D and S are on the left and the output X is on the right. S goes into a NOT gate; D and the output of the NOT gate go into an AND gate, whose output is X.

S goes into a NOT gate. Its output and D go into an AND gate. The output column, in row order, is 0, 0, 1, 0. The alarm sounds in one row only: the door is open and the switch is at 0.

Practise with new numbers

Try it in Python

The program works out X = A OR (NOT B) one gate at a time, just like the middle column. Then it counts the rows that give 1.

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

1. Change the circuit to X = (NOT A) OR B. Predict which row gives 0, then run it.

2. Change OR to AND in the line x = OR(a, p). How many rows give 1 now?

Common mistakes

  • Treating OR as one or the other but not both. OR gives 1 in the row 1 1 too.
  • Skipping the middle column. Work out each gate's output first. It is quicker and you make fewer slips.
  • Using the input where the circuit uses a gate's output. Follow each wire from the picture back to where it starts.

Remember these

  • OR gives 0 only when both inputs are 0: X = A OR B.
  • The output column of OR is 0, 1, 1, 1.
  • In a circuit, the output of one gate feeds the next. Add a column for each gate's output.
  • Brackets in an expression show which gate is worked out first.

Check yourself

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

  1. An OR gate has A = 0 and B = 1. What is the output?
  1. In how many rows of its truth table does an OR gate give 1?
  1. A circuit is X = NOT (A AND B). Work out X when A = 1 and B = 1.
  1. A plant waterer turns on when the soil is dry (D = 1) or the timer says it is morning (M = 1). Write the expression for the waterer W.
  1. In the circuit X = A OR (NOT B), which row gives X = 0?

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 NOT, AND and OR Gates

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 shop alarm X rings when the window sensor (W = 1) or the door sensor (D = 1) is set off…Easy · High School (9–10) · by StemPy Lab
Asha builds a two-gate circuit on a breadboard…Medium · High School (9–10) · by StemPy Lab
A plant-watering controller has three inputs…Hard · High School (9–10) · by StemPy Lab
That was the last lessonBack to the course: take the test
← NOT, AND and OR Gates
← The AND gateNext →

Discussion (0)

Log in to join the discussion.

Loading…

Three circuits are built from NOT, AND and OR gates: X = NOT (A OR B); Y = (NOT A) AND (NOT B); Z =…
Hard · High School (9–10) · by StemPy Lab

Python Labs (1)

A door alarm with two gatesPython Lab · by StemPy Lab

Question Sets (1)

NOT, AND and OR: Check Your Understanding10 questions · by StemPy Lab

Notes (1)

NOT, AND and OR Gates: Quick RevisionNote · by StemPy Lab