Single lesson · Written for AQA GCSE Computer Science (8525)

Boolean logic in programs – AQA GCSE Computer Science lesson (8525)

Pupils learn to use AND, OR and NOT in conditions to match a logic rule.

Also in a bundle Binary, Logic and Iteration – AQA GCSE Computer Science lessons (8525) 13 lessons for £39 · save 25% on buying separately

Lesson 12 of 13 in unit 10.3 Binary, Logic and Iteration, taught in Year 10, Spring 1. It answers one big question: How do logic gates show up in the code we write?

By the end, pupils can use AND, OR and NOT in conditions to match a logic rule.

The Build (the main task)
Write a program that inputs whether it is dark, whether someone is at the door and whether the light has been switched off manually (each as Y or N). It must output Light on if it is dark AND someone is there AND the light has NOT been switched off, and Light off otherwise. Apply the rule with one condition that uses Boolean operators. (5 marks)
Support version
A Parsons problem: the porch light program's lines jumbled, with one distractor line written in Boolean expression notation.
Challenge
Write the porch light's condition as a Boolean expression using AQA's symbols (D = dark, S = someone there, O = switched off), and draw its logic circuit. (4 marks) Write a program for the alarm with a panic button. Input armed, door, window and panic as Y or N. Output Alarm if it is armed AND the door OR the window is open, or if panic is pressed; otherwise output Quiet. (5 marks) Write a program for the heating. Input the hour (0 to 23) and whether the family is on holiday (Y or N). Output Heating on if the hour is from 7 to 22 inclusive AND it is NOT a holiday; otherwise output Heating off. (6 marks)
Real-world link
The porch light's logic rule turned into code.
Key words
Boolean operator, Boolean and Apply, each with a definition, an icon and a common mix-up on the key vocabulary slide.
Misconceptions it tackles
“and/or in code work like the + and . symbols the other way round”; “not dark and someone is the same as not (dark and someone)”.
AQA 8525 specification
3.2.5; 3.4.2 (boolean logic: NOT, AND, OR and XOR gates, truth tables, logic circuits and Boolean expressions).

Every lesson follows the same Code & Commerce structure: a Bell Task recall starter, key vocabulary with definitions and icons, short teaching chunks with a check before pupils move on, The Build (one main task), challenge questions that get harder, and an exit question. Answers reveal one at a time on the slides, and everything is editable PowerPoint and Word.

Pupils need computers for the main task.

Also sold in the Binary, Logic and Iteration unit bundle, which includes the medium term plan, and in the full-year and complete-course bundles.

Choose your school's Paper 1 language when you buy: C#, Python or VB.NET. You get that language's files: every program, code example, worked answer and programming task is written in it, and lessons with no code are the same in all three. Algorithms are also shown in AQA pseudo-code, as in the exam.

An independent resource written for AQA GCSE Computer Science (8525). It is not endorsed by AQA.

What's included

  • Slide deck (PowerPoint)
  • Lesson plan (Word)
  • Worksheet (Word)
  • Support worksheet with scaffolds (Word)
  • Boolean logic in programs - Quiz Quiz Trade Cards
  • Single-teacher licence: use and adapt it with your own classes
  • Your choice of Paper 1 language: C#, Python or VB.NET

More for GCSE Computer Science (AQA)

See all

Written for the specifications named. Not endorsed by or affiliated with any exam board.