Computer Science - 9210 OxfordAQA

Subroutines (procedures And Functions)

Overview

Open the skeleton program that Paper 1 is built around and you will not find one long list of instructions. You will find a dozen named blocks: one that creates the board, one that places the snakes and ladders, one that displays the board, one that makes a move. Nothing forced the author to write it that way, and every real program is written that way, which is a strong hint that something is being gained.

This lesson covers what a subroutine is, why programs are built out of them, and the two channels through which data travels between a subroutine and the code that called it. Parameters carry data in; return values carry it back out. You will also meet local and global variables, which is where the specimen paper puts two of its marks, and you will learn to say precisely what happens when a subroutine is called rather than waving at it.

Objectives

  1. Understand the concept of subroutines.
  2. Explain the advantages of using subroutines in programs. Use and describe the use of parameters to pass data within programs.
  3. Use subroutines that return values to the calling routine.

Mind map

This topic is mapped out so you can see how the ideas connect.

Open the mind map in the app

Lesson Note

The specification's definition is worth learning word for word, because it is compact and it earns marks: a subroutine is a named out of line block of code that may be executed, or called, by simply writing its name in a program statement.

Complete Note Available on the Green Bridge App

Get the Green Bridge CBT app on your phone or computer for the complete IGCSE library: past papers, mark schemes, mind maps, flashcards and audio lessons.

Full lesson notes with diagrams
AI-powered learning assistant
Timed mock exams marked the moment you finish
Available on Android, Windows, macOS, and Linux iOS app coming soon

Lesson Evaluation

Congratulations on completing the lesson on Subroutines (procedures And Functions). Now that youve explored the key concepts and ideas, its time to put your knowledge to the test. This section offers a variety of practice questions designed to reinforce your understanding and help you gauge your grasp of the material.

You will encounter a mix of question types, including multiple-choice questions, short answer questions, and essay questions. Each question is thoughtfully crafted to assess different aspects of your knowledge and critical thinking skills.

Use this evaluation section as an opportunity to reinforce your understanding of the topic and to identify any areas where you may need additional study. Don't be discouraged by any challenges you encounter; instead, view them as opportunities for growth and improvement.

  1. Which statement best describes a subroutine? A. A variable that holds several values B. A named out of line block of code that is executed by writing its name C. A loop that repeats a fixed number of times D. A file that stores program output Answer: B
  2. How many parameters does the subroutine SUBROUTINE Total(A, B, C) have? A. 0 B. 1 C. 3 D. It depends on the call Answer: C
  3. Which statement about a local variable is correct? A. It can be used anywhere in the program B. It uses memory for the whole time the program is running C. It can be used only within the subroutine it is declared in D. It must be a parameter Answer: C
  4. What is the difference between a procedure and a function? A. A function returns a value and a procedure does not B. A procedure can take parameters and a function cannot C. A function is always shorter D. A procedure cannot be called more than once Answer: A
  5. Which is NOT an advantage of using subroutines given in the specification? A. The program runs faster on every machine B. Subroutines can be re-used C. Subroutines can be tested independently D. The structure of the program is clearer Answer: A

Work through these questions in the app

Work through these questions in the app

Practice Mock Questions

Want to practice mock questions on Subroutines (procedures And Functions)? Download the Green Bridge CBT app to access mock questions and full practice assessments for this topic.

Download The App On Google Playstore

Everything you need to excel in your exams

Green Bridge CBT Mobile App
Personalized AI Learning Chat Assistant
200,000+ Exam Questions Across IGCSE, JAMB, WAEC & NECO
Over 3,900 Lesson Notes
Offline Support - Learn Anytime, Anywhere
Green Bridge Timetable
Literature Summaries & Potential Questions
Track Your Performance & Progress
In-depth Explanations for Comprehensive Learning