Single lesson · Written for OCR A Level (H446)

Bitwise masks: AND, OR and XOR – OCR A Level Computer Science lesson (H446)

Students learn to apply AND, OR and XOR masks to clear, set, flip and isolate chosen bits, and explain the purpose of each mask.

Also in a bundle Data Representation and Logic Gates – OCR A Level Computer Science lessons (H446) 13 lessons for £45 · save 13% on buying separately

Lesson 7 of 13 in unit 12.3 Data Representation and Logic Gates, taught in Year 12, Autumn 2. It answers one big question: How can one byte report several things at once?

By the end, students can apply AND, OR and XOR masks to clear, set, flip and isolate chosen bits, and explain the purpose of each mask.

The Build (the main task)
Write the mask and operation that isolates bit 1 (battery low) of a Wrenhome Sensors door sensor's status byte 0100 0011, then those that set bit 7 (tamper) and flip bit 0 (door open), giving each result (6 marks).
Support version
Three worked rules (AND with 0 clears, OR with 1 sets, XOR with 1 flips) and a bit-number strip (7 to 0) above the byte.
Challenge
Explain how the hub could test whether the battery-low bit or the tamper bit is set using a single mask.
Real-world link
Wrenhome Sensors's door sensor packs eight on/off flags into one status byte to save battery on every message.
Key words
Bitwise operation, Mask and Isolate, each with a definition, an icon and a common mix-up on the key vocabulary slide.
Misconceptions it tackles
“Applying a mask means adding it to the byte”; “In an AND mask, a 1 clears the bit”.
OCR H446 specification
1.4.1 (i).

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.

Students can do it all on paper.

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

An independent resource written for OCR A Level Computer Science (H446). It is not endorsed by OCR or Cambridge University Press & Assessment. Programming project (NEA) lessons teach general skills on a made-up example project and give supervised time, within JCQ's rules on the help a centre may give.

What's included

  • Slide deck (PowerPoint)
  • Lesson plan (Word)
  • Worksheet (Word)
  • Support worksheet with scaffolds (Word)
  • Single-teacher licence: use and adapt it with your own classes

More for A Level Computer Science

See all

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