Binary, Boolean Logic and Iteration – OCR GCSE Computer Science lessons (J277)
11 OCR J277 lessons on units, binary, hex, binary shifts and logic gates, with FOR and WHILE loops in Python.
The third GCSE unit keeps both papers side by side. On the Paper 1 track pupils learn how a computer writes every number with 0s and 1s: units of data from bit to petabyte, converting between binary, denary and hexadecimal, binary addition with overflow, and binary shifts. On the Paper 2 track they learn iteration – FOR loops that repeat a set number of times and WHILE and DO UNTIL loops that repeat until something changes – and Boolean logic: AND, OR and NOT gates, truth tables, logic diagrams, and the same logic written as conditions in Python. Every lesson is set in one smart home hub, so the numbers, gates and loops pupils meet are the ones running a doorbell, a thermostat, an alarm and a door lock.
Unit 10.3 is taught in Year 10, Spring 1, and answers one big question: How do 0s and 1s become numbers, decisions and repeats? Every lesson uses the same real-world context (one smart home hub runs through the unit: a doorbell's memory card, the thermostat, a smart meter, the smart bulbs, the porch light, the alarm, the door lock and the heating), and pupils make smart home programs that switch off every light, unlock the door with a PIN and control the heating, plus the alarm's logic diagram. The careers link is an embedded software engineer: an embedded software engineer writes the code inside smart home devices, working with binary, bit shifts, loops and logic every day – the skills in this unit.
What happens in each lesson:
Lesson 1, Units of data: bit to petabyte: How do we measure how much data there is? Main task: calculate how many 2 MB doorbell video clips fit on a 64 GB memory card, and how many bits are in a 5 KB settings file, showing every step and unit.
Lesson 2, Count-controlled loops (FOR): How can a program repeat steps a set number of times? Main task: write a Python program that inputs how many lights are in the house and uses iteration (a FOR loop) to print 'Light 1 off', 'Light 2 off' and so on for every light, then 'All lights off' once at the end.
Lesson 3, Binary and denary conversion: How does a computer write any number using only 0 and 1? Main task: complete four thermostat conversions: denary 19 and 22 into 8-bit binary, and binary 00010101 and 11111111 into denary, showing the place values for each.
Lesson 4, Binary addition and overflow: What happens when a binary sum is too big to fit? Main task: complete three 8-bit binary additions of smart meter readings, showing every carry: a) 00110101 + 00011010, b) 01101110 + 00101011, c) 10110100 + 01100011. Then explain which one causes an overflow error and why.
Lesson 5, Condition-controlled loops (WHILE, DO UNTIL): How can a program keep repeating until something changes? Main task: write a Python program for the smart door lock that uses a WHILE loop (a condition-controlled loop) to keep asking for the PIN until 4721 is entered, printing 'Wrong PIN' after each wrong try, then prints 'Door unlocked'.
Lesson 6, Binary shifts: How can sliding the bits multiply or divide a number? Main task: complete three binary shifts on 8-bit sensor values – a) 00010110 left 2, b) 01101000 right 1, c) 00100101 left 3. State the denary value before and after each, the effect (multiply or divide by what), and explain why c gives the wrong answer.
Lesson 7, Hexadecimal: Why do programmers write binary as hexadecimal? Main task: complete three smart bulb colour conversions – a) hex 3C to denary, b) binary 10101110 to hex, c) denary 201 to hex – showing the nibbles or place values. Then explain two reasons why the app shows colours in hexadecimal rather than binary.
Lesson 8, Logic gates and truth tables: How can tiny switches make decisions? Main task: complete the truth tables for the AND, OR and NOT logic gates on your worksheet. Then state which gate a smart porch light needs if it switches on only when it is dark AND motion is detected, and draw its symbol with the inputs and output labelled.
Lesson 9, Logic diagrams with more than one gate: How do we combine gates to make bigger decisions? Main task: draw the logic diagram for the smart alarm Q = (D AND S) OR P, where D is the door opening, S is the alarm being set and P is the panic button. Then complete its truth table on your worksheet.
Lesson 10, Boolean logic in programs: How do logic gates show up in the code we write? Main task: write a Python program for the smart heating that inputs the temperature and whether anyone is home (Y or N), and applies Boolean logic to print 'Heating on' if it is below 18 °C and someone is home, or if it is below 3 °C; otherwise 'Heating off'.
Lesson 11, Progress Check: 23 multiple-choice questions (the teacher assigns them to the class as homework or at the start of the next lesson) + a 40-minute written paper of 40 marks (Section A 26 marks, Section B 14 marks), printed with its Mark Scheme.
- Misconceptions it tackles include
- “To change to a bigger unit you multiply (e.g. 3,000 KB × 1,000 to get MB)”; “range(1, 10) includes 10”; “Place values go 1, 2, 4, 8 … from left to right”. Each is planned into a hinge question before the main task or an exit question, so you find out who still holds it.
- OCR J277 specification coverage
- 1.2.3, units: why data must be stored in binary; bit, nibble, byte, kilobyte, megabyte, gigabyte, terabyte and petabyte; converting between units (1,000 or 1,024); 1.2.4, data storage – numbers: converting between denary, 8-bit binary and 2-digit hexadecimal; adding two 8-bit binary numbers and overflow errors; binary shifts; 2.2.1, programming fundamentals: iteration – count-controlled loops (FOR) and condition-controlled loops (WHILE, DO UNTIL); Boolean operators in conditions; 2.4.1, boolean logic: AND, OR and NOT gates, their symbols and truth tables; logic diagrams and Boolean expressions with up to three inputs; applying logical operators in programs.
It builds on 10.2 Memory, Storage and Selection (capacity, IF statements, comparison and Boolean operators), 10.1 data types and MOD/DIV, and KS3 7.4 Binary, 8.1 Python: Iteration and 8.2 Boolean Logic and Circuits. It leads on to 10.4 Characters, Images, Sound, Strings and Arrays (file sizes use these units and binary; arrays are processed with loops), 10.5 trace tables and searching (loops and conditions), 11.1 input validation with WHILE loops, 11.4 revision.
- Adapting it for your school
- Lessons 3, 4, 6 and 7 need no computers. The programming lessons (2, 5, 10) work in any Python 3 editor; each has a paper version for when the computer room is not available. Python and OCR Exam Reference Language differ: range(1, 11) is for i = 1 to 10; Python has no DO UNTIL (taught in ERL on paper); and/or/not are AND/OR/NOT. OCR accepts 1,000 or 1,024 for unit conversions; these lessons use 1,000. Change the worked examples if your department prefers 1,024. Swap the smart home hub for any device pupils know, such as a fitness watch or a games console, keeping the same numbers.
Two versions in one download. The "With quiz" folder is for schools with a Code & Commerce Quizzes subscription: wherever the lessons use a Progress Check, its multiple-choice questions are ready-made on the quiz site for you to set, with a printed version as the backup. The "Without quiz" folder is the same teaching for standalone use, with no mention of the quiz site and every check on paper. You don't need a quiz subscription to use it.
What's included
- 11 lesson slide decks (PowerPoint)
- 11 lesson plans (Word)
- 11 worksheets, plus 10 support versions with scaffolds (Word)
- 1 exam-style paper with mark scheme (Word)
- Medium term plan with intent, key words, misconceptions and adaptive teaching notes (Word)
- Progress Check lesson to assess the unit
- Boolean logic in programs - Quiz Quiz Trade Cards
- Department licence: every teacher in your department can use and adapt it
- Two versions of the files: one for Code & Commerce Quizzes subscribers and one for standalone teaching, no quiz site needed
In this bundle
Worth £44 bought separately at £4 a lesson. The bundle saves you 11%.
More for GCSE Computer Science (OCR)
See all13 OCR J277 lessons on the CPU, von Neumann architecture, fetch–execute and embedded systems, with first Python programs.
Free sample lesson14 OCR J277 lessons on RAM, ROM, virtual memory and secondary storage, with IF, ELSE IF, CASE and Boolean conditions.
Free sample lesson11 OCR J277 lessons on ASCII and Unicode, images, sound, compression and file size calculations, with strings and arrays.
Free sample lessonWritten for the specifications named. Not endorsed by or affiliated with any exam board.