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 AND gate

Course 10.1·Lesson 2 of 3

The AND gate

An AND gate gives 1 only when both of its inputs are 1. You learn its symbol, its truth table with the rows in the order the examination uses, and the logic expression A AND B. Then you use it for everyday rules with the word and.

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 2 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.

Both at once

A hand dryer runs when your hands are under it and the power is on. Either one alone is not enough. A machine in a workshop starts when the safety guard is closed and the start button is pressed. These rules need both conditions at the same time.

The AND gate

The AND gate gives 1 only when input A and input B are both 1. In every other case it gives 0.

An AND gate symbol, with a flat back and a round front. Input A enters at the top left, input B at the bottom left, and the output X leaves on the right.

The symbol has a flat back and a round front. The two inputs come in on the left, and the output leaves on the right.

A BX = A AND B
0 00
0 10
1 00
1 11

The logic expression is X = A AND B.

The order of the rows

The examination always lists the rows in the same order. Read the inputs as a binary number and count up: 0 0, then 0 1, then 1 0, then 1 1. The input A changes slowest and B changes fastest. Use this order every time. Then you can never miss a row or write one twice.

Using AND for a rule

An example. A safe opens when the key is turned (K = 1) and the right code is typed (C = 1). The rule is S = K AND C. Check the four rows. Only K = 1, C = 1 opens the safe. If either is 0, the safe stays shut.

The word "and" in a problem is a strong sign that you need an AND gate. Read the sentence carefully though. "The light is on when the door is open and it is dark" has one AND, between "the door is open" and "it is dark".

Practise with new numbers

Try it in Python

The program writes the AND gate as a function. The two loops print the rows in the examination order. Then it works out the hand dryer.

Read it first. Then run it. In how many rows is the output 1?

1. Change power = 0 to power = 1. What does the dryer do now?

2. Swap the two loops, so that b is the outer loop. Does the order of the rows change?

In Python, the word and does the same job for True and False. In Cambridge pseudocode the same word AND joins two conditions. You will see this in the last lesson of this chapter.

Common mistakes

  • Thinking AND gives 1 when one input is 1. It needs both inputs to be 1.
  • Rows in a random order. Count up in binary: 0 0, 0 1, 1 0, 1 1. A missing row loses marks.
  • Drawing the AND gate with a curved back. The curved back belongs to OR. AND has a flat back.

Remember these

  • AND gives 1 only when both inputs are 1: X = A AND B.
  • The output column of AND, top to bottom, is 0, 0, 0, 1.
  • Rows go in binary order, with A changing slowest.
  • AND has a flat back and a round front.

Check yourself

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

  1. An AND gate has A = 1 and B = 0. What is the output?
  1. Write the four rows of a two-input truth table in the examination order.
  1. A kettle switches on when it has water in it (W = 1) and the switch is pressed (P = 1). Write the expression for the kettle K.
  1. The output of an AND gate is 1. What can you say about its inputs?
  1. Spot the mistake. A student says: "An AND gate gives 0 only when both inputs are 0." Is that right?

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 (3)

A microwave oven heats food only when its door is closed (D = 1) and the start button is pressed (S…Easy · High School (9–10) · by StemPy Lab
A ride at a fair can start (X = 1) only when three things are all true: the gate is closed (G = 1)…Medium · High School (9–10) · by StemPy Lab
A student was asked for the truth table of an AND gate…Medium · High School (9–10) · by StemPy Lab
Next: lesson 3The OR gate and joining two gates
← NOT, AND and OR Gates
← Logic gates and the NOT gateThe OR gate and joining two gates →

Discussion (0)

Log in to join the discussion.

Loading…

Python Labs (1)

The three gates as functionsPython Lab · by StemPy Lab