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 →
Live examsInternational live exams are comingTell us which exam you want first. Timed practice papers are open now.See what is coming →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Space Science and Astronomy
  • Earth and Environmental 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
  1. Computer Science
  2. /Algorithms, Programming and Logic
  3. /Boolean Logic

Boolean Logic

Computer Science · High School (9–10) · 3 courses, 30 worked problems, 30 practice questions

Inside a computer, every decision comes down to true or false, written as 1 or 0. Boolean logic is the algebra of these two values, and logic gates carry it out in hardware. An AND gate gives 1 only when both inputs are 1. An OR gate gives 1 when at least one input is 1, and a NOT gate reverses its input. NAND, NOR and XOR are other common gates. A truth table lists the output for every set of inputs. A problem statement can be turned into a logic expression, drawn as a circuit and checked with a truth table.

With practice you will be able to

  • Write the truth table for AND, OR, NOT, NAND, NOR and XOR
  • Draw a logic circuit from a logic expression
  • Write a logic expression from a problem statement

On the syllabus of

  • IGCSE

Lessons

  • NOT, AND and OR GatesWhy does a street lamp need a NOT gate? When does an AND gate give 1?High School (9–10)
  • NAND, NOR and XOR Gates and Truth TablesHow can two switches control one stair light? Can you name a logic gate from its outputs alone?High School (9–10)
  • Logic Circuits, Logic Expressions and Truth TablesHow many rows does a truth table need for three inputs? How do words become a circuit?High School (9–10)

Practice questions

Choose an answer, then check it. Each one shows a full explanation.

A logic gate gives an output of 1 only when both of its two inputs are 1. Which gate is it?

A rain sensor feeds a NOT gate. The sensor reads 0 because it is dry. What does the NOT gate give, and why?

In the syllabus symbols, which gate is drawn with a curved back and a pointed front, with no small circle at the output and no extra curved line behind it?

An OR gate is tested with the input pairs 0 0, 0 1, 1 0 and 1 1 in turn. Which list shows what it outputs?

Worked problems

Each one has a hint, the key idea and a full worked solution.

  • A street lamp is controlled by a light sensor L through a NOT gate…Easy
  • A student has to learn the six logic gate symbols of the syllabus: NOT, AND, OR, NAND, NOR and XOR…Easy
  • Three NOT gates are joined in a chain. The input A goes into the first gate, its output goes into…Medium
  • A microwave oven heats food only when its door is closed (D = 1) and the start button is pressed (S…Easy

Python labs

  • The three gates as functions
  • A door alarm with two gates
  • NAND, NOR and XOR from three gates
  • Name the gate from its column
  • A three-input truth table
  • From a truth table to an expression

Related topics

  • Algorithms, Programming and Logic
  • Algorithms and Problem-Solving
  • Databases and SQL
  • Programming

A circuit lights a warning sign. In it: A goes into a NOT gate; the output of the NOT gate and B go into an OR gate, whose output is X. Which pair of inputs is the only one that keeps the sign dark, with X = 0?

A bank vault opens only when three managers each turn their own key at once. The circuit is built from two-input AND gates. Of all the possible on and off settings of the three keys, how many keep the vault shut?

A garden light L comes on when it is dark (D = 1) and movement is detected (M = 1). Which logic expression describes the light?

A circuit is X = (A OR B) AND (NOT C). Which set of inputs makes X equal to 1?

A student must draw a circuit for X = A AND B AND C. The student draws one AND gate with three inputs. What should the circuit be?

Which expression gives the same output as NOT (A AND B) in every row of the truth table?

All 30 practice questions on Boolean Logic →

A ride at a fair can start (X = 1) only when three things are all true: the gate is closed (G = 1)…
Medium
  • A student was asked for the truth table of an AND gate…Medium
  • A shop alarm X rings when the window sensor (W = 1) or the door sensor (D = 1) is set off…Easy
  • Asha builds a two-gate circuit on a breadboard…Medium
  • A plant-watering controller has three inputs…Hard
  • Three circuits are built from NOT, AND and OR gates: X = NOT (A OR B); Y = (NOT A) AND (NOT B); Z =…Hard
  • A cutting machine has a warning light W…Easy
  • A printer has a "ready" lamp R. A jam sensor gives J = 1 when paper is stuck, and an ink sensor…Medium
  • All 30 worked problems on Boolean Logic →