Signed up recently but had issues with the confirmation email?

Click Forgot password and follow the reset steps. You can choose the same password you used when you signed up. This should then provide access.

Remember to check Spam and Junk. The email will be from auth@progressbytes.co.uk.

Revision notesQuestionsFor schools
Revise Computing
Log inStart revising free
Revision notesQuestionsFor schoolsLog in

© 2026 Revise Computing · revisecomputing.co.uk

Worried about something?Question Bank UpdatesPrivacy noticeTermsContact

Revise Computing is an independent revision resource. It is not affiliated with, or endorsed by, OCR (Oxford Cambridge and RSA Examinations).

Knowledge/A Level/H446/02 Algorithms and programming/Programming Techniques/Modularity, functions and procedures…

Modularity, functions and procedures, parameter passing by value and by reference

Modularity, functions and procedures, parameter passing by value and by reference.

2.2.1 Programming Techniques

Practise exam questions

Programming Techniques — Note 4 of 6

Candidates need to understand what is meant by modular code and how it is produced using functions and procedures, including the differences between them. Candidates need to understand the purpose of parameters and the difference between passing by value and by reference, recommending which to use for a given situation. Candidates need to be able to read, trace and write code that uses functions, procedures and parameters.

What you need to know

Modular programs are built from subroutines, each carrying out one task. Functions return a value; procedures do not. Parameters can be passed by value (a copy) or by reference (the original), which affects whether the subroutine can change the caller's data.

What to know

  • By value: safer, as the original cannot be changed accidentally, but copying large data uses memory and time. By reference: efficient for large data structures and allows a subroutine to return more than one change, but the original can be changed unintentionally.
  • In OCR pseudocode, parameters are passed by value unless stated; where it matters, byVal and byRef are used.

Code examples

Passing by value and by reference (OCR pseudocode)
text
procedure update(x:byVal, y:byRef)
    x = x + 10
    y = y + 10
endprocedure

a = 1
b = 1
update(a, b)
print(a)   // 1  (only the copy changed)
print(b)   // 11 (the original changed)

Key terms

Modular programming

Breaking a program into separate subroutines or modules, each performing one task, that can be written and tested independently.

Function

A subroutine that returns a value to the point where it was called.

Procedure

A subroutine that carries out a task but does not return a value.

Parameter

A variable in the subroutine definition that receives a value (argument) when the subroutine is called.

Passing by value

A COPY of the argument is passed; changes inside the subroutine do not affect the original variable.

Passing by reference

The ADDRESS of the original variable is passed; changes inside the subroutine DO affect the original variable.

Exam technique

  • Mistake:'By value means the value can't change.' The subroutine's COPY can change; the caller's original is unaffected and the copy is discarded when the subroutine ends. By reference works on the original, so its changes are still there after the subroutine ends.
  • Tip:Trace by-reference parameters carefully: any change to the parameter inside the subroutine changes the caller's variable.
  • Tip:To say why a subroutine is a function, point to the value it returns. 'It produces an output' is not credited, because a procedure can print too.
  • Tip:Justify by value or by reference for the subroutine given. By value: it only reads the data and the caller's variable must stay unchanged. By reference: it must change the caller's data (e.g. swap(a, b)), or copying a large structure would waste memory.
  • Tip:By reference changes the caller's variable only if the subroutine assigns to that parameter. For a subroutine that only reads its parameters, justify by value because the original must not be altered, not because by reference would crash or give a wrong result. By reference is the right choice when the subroutine must change the caller's data, such as sorting an array in place: by value would sort a copy and leave the original unsorted.
  • Mistake:Writing a declaration (function isPrime(17)) when you need a call. A call is the name and arguments, e.g. found = isPrime(17); store or test the returned value, and test a Boolean directly (if found then), not against the string "True". When the question gives you a function, don't rewrite it: call it ONCE, store the result, and handle both outcomes. If the function changes data (e.g. adds an item to a list), calling it again to test the result makes that change twice.

Past exam questions

  • June 2026Paper 2Q1(b)(ii)4marks
  • June 2026Paper 2Q9(d)(iii)1mark
  • June 2026Paper 2Q9(e)3marks
  • June 2025Paper 2Q6(c)2marks
  • June 2024Paper 2Q5(c)4marks
  • June 2022Paper 2Q1(b)(ii)2marks
  • June 2022Paper 2Q6(b)(i)1mark
  • November 2020Paper 2Q4(a)2marks
  • June 2019Paper 2Q1(b)(i)1mark
  • June 2019Paper 2Q3(a)(iii)1mark
  • June 2019Paper 2Q3(a)(iv)2marks
  • June 2018Paper 2Q4(b)2marks
  • June 2017Paper 2Q3(a)(ii)4marks
  • June 2017Paper 2Q6(c)(i)3marks
  • June 2017Paper 2Q6(c)(ii)3marks

Ready to test yourself?

Practise 2.2.1 questions
← Previous noteGlobal and local variables2.2.1 Programming TechniquesNext note →Use of an IDE to develop/debug a program2.2.1 Programming Techniques

Back to Programming Techniques

Programming Techniques

Note 4 of 6

  1. 1Programming constructs: sequence, iteration, branching
  2. 2Recursion, how it can be used and how it compares to an iterative approach
  3. 3Global and local variables
  4. 4Modularity, functions and procedures, parameter passing by value and by reference
  5. 5Use of an IDE to develop/debug a program
  6. 6Use of object oriented techniques
Topic overview