Single lesson · Written for OCR A Level (H446)

Parameters: by value and by reference – OCR A Level Computer Science lesson (H446)

Students learn to explain the difference between passing by value and by reference, predict the effect on the caller's variables and choose the right method.

Also in a bundle Programming Foundations and Computational Thinking – OCR A Level Computer Science lessons (H446) 16 lessons for £45 · save 29% on buying separately

Lesson 11 of 16 in unit 12.2 Programming Foundations and Computational Thinking, taught in Year 12, Autumn 1. It answers one big question: Can a subroutine change the caller's variables?

By the end, students can explain the difference between passing by value and by reference, predict the effect on the caller's variables and choose the right method.

The Build (the main task)
Trace the given pseudocode, in which a Fernbridge CycleShare procedure moves bikes between two stations using one parameter passed by value and one passed by reference, and explain the values of both variables after the call (5 marks).
Support version
A trace table with a column for each variable in the caller and in the procedure, and the first two rows filled in.
Challenge
Explain how Python behaves differently: why changing a list inside a function changes the caller's list, but reassigning an integer parameter does not.
Real-world link
Fernbridge CycleShare's vans move spare bikes from a quiet station to a busy one.
Key words
Parameter passing by value, Parameter passing by reference and Implication, each with a definition, an icon and a common mix-up on the key vocabulary slide.
Misconceptions it tackles
“Changing a parameter passed by value changes the caller's variable”; “Passing by reference is the same as indirect addressing in assembly language”.
OCR H446 specification
2.2.1 (d).

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.

Also sold in the Programming Foundations and Computational Thinking 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.