New
New
Lesson 1 of 6
  • Year 10
  • OCR

Structured programs

I can describe what is meant by a structural approach to programming and explain the benefit of this approach.

Lesson 1 of 6
New
New
  • Year 10
  • OCR

Structured programs

I can describe what is meant by a structural approach to programming and explain the benefit of this approach.

Lesson details

Key learning points

  1. As programs grow in complexity it becomes useful to structure them in a way that is more manageable for the programmer.
  2. A structured approach to programming uses a module approach where a program is seperated into subprograms.
  3. A program can be decomposed into smaller subprograms that are easier to solve indepedently.
  4. The interface determines how data will be passed in and out of the subprogram.

Keywords

  • Subprogram - a sequence of instructions to perform a specific task with an identifiable name

  • Interface - describes how a subprogram will interact with the main program

  • Indentifer - a name for a variable or subprogram

  • Parameters - used in a subprogram to allow values to be passed into them

Common misconception

A program must run line by line from top to bottom.

A subprogram is an 'out of line' block of code, which is typcially written at the top of a program and then called upon within the main program.


To help you plan your year 10 computer science lesson on: Structured programs, download all teaching resources for free and adapt to suit your pupils' needs...

This topic links with the concept of decompostion. Encourage pupils to think in high-level terms about what a program needs to do by using a heirachy diagram to plan the parts of a program rather than just diving in and coding.
Teacher tip

Equipment

Licence

This content is © Oak National Academy Limited (2025), licensed on Open Government Licence version 3.0 except where otherwise stated. See Oak's terms & conditions (Collection 2).

Lesson video

Loading...

Prior knowledge starter quiz

Download quiz pdf

6 Questions

Q1.
Programming languages are considered to be high or low level, which of the following languages are high level?

machine code
Correct answer: C#
Correct answer: Python
assembly language

Q2.
What Python function is used to display output?

input()
output()
Correct answer: `print()`
display()

Q3.
What operator is used for multiplication in Python?

%
/
Correct answer: `*`
+

Q4.
Can you work out the value of the variable total once the code has finished executing?
123456
total = 0 FOR i = 0 TO 3 FOR j = 0 TO i total = total + i NEXT j NEXT i
Code colour

When programmers write code, they use a special tool called an IDE (Integrated Development Environment). In an IDE, different colours are used to help programmers understand the code:


  • • Blue - numbers and boolean values
  • • Green - strings
  • • Purple - keywords

Correct Answer: 20

Q5.
What data type is used in Python to hold whole numbers?

Correct Answer: integer, int, int()

Q6.
Which type of loop is used for condition controlled iteration in Python?

Correct answer: while
loop
now
for
forever

Assessment exit quiz

Download quiz pdf

4 Questions

Q1.
The structured approach to programming provides many benefits. From the list below select the statements that specify a benefit of using the structured approach.

Correct answer: Subprograms make use of return values so the use of global variables is reduced.
A structured program will execute more quickly.
Correct answer: Subprograms are easier to test because they perform a single task.
Correct answer: Meaningful identifiers for subprograms help to make the program code readable.
Correct answer: It is quicker because many subprograms can be worked on at the same time.

Q2.
Select the statement that is true.

A subprogram must be defined and executed at some point in the program.
Correct answer: Subprograms make programs easier to read and understand.
Procedures allow values to be returned to the procedure call.

Q3.
A student wants a subprogram that will add any two given numbers together and to display the answer. Use the lines of code below to construct a display_sum subprogram for them.

1 - def display_sum (num1, num2):
2 - answer = num1 + num2
3 - print(answer)

Q4.
What is num1 in this line of code?
1
def display_sum (num1, num2):
Code colour

When programmers write code, they use a special tool called an IDE (Integrated Development Environment). In an IDE, different colours are used to help programmers understand the code:


  • • Blue - numbers and boolean values
  • • Green - strings
  • • Purple - keywords

identifier
return value
Correct answer: parameter
variable