Pearson Edexcel · GCSE · Computer Science
Course version: Pearson-GCSE-Computer-Science · Version from Mar 2026
Constructs
Master the fundamental building blocks of all software: Sequence, Selection, and Iteration. This topic is the core of Computer Science and tests your ability to think like a real programmer, enabling you to read, trace, and write code confidently for the exam.
- 4 min read
- 3 worked examples
- 5 practice questions
- 6 key terms
Study Notes
Overview
Open full-size image (opens in a new tab)
Welcome to Programming Constructs! This topic is the beating heart of Computer Science. Whether you are building a simple calculator or the software that runs a Mars rover, every single program is built from just three fundamental structural components: Sequence, Selection, and Iteration.
Understanding these constructs is crucial because examiners don't just want you to memorise definitions; they want to see you apply them to solve problems. This topic connects deeply to algorithms, data representation, and computational thinking. Typical exam questions will ask you to write code snippets, trace algorithms using trace tables, or identify logic errors where these constructs have been used incorrectly.
Key Concepts
Concept 1: The Three Core Constructs
Every program relies on these three building blocks. Examiners expect you to identify them and use them appropriately.
Open full-size image (opens in a new tab)
- Sequence: This is the default behaviour of a program. Instructions are executed one after another, in the exact order they are written, from top to bottom. If you write
print("A")beforeprint("B"), "A" will always appear first. - Selection: This allows a program to make decisions. It uses conditions (which evaluate to True or False) to determine which path of code to execute. We typically use
if,elif, andelsestatements. Think of it like a fork in the road. - Iteration: This is looping—repeating a block of code. There are two main types you must master:
- Count-controlled iteration (
forloops): Used when you know exactly how many times the code needs to repeat. - Condition-controlled iteration (
whileloops): Used when you don't know how many times the code needs to repeat; it loops until a condition becomes False.
- Count-controlled iteration (
Concept 2: Variables and Constants
Programs need to store data while they run.
- A variable is a named memory location whose value can change while the program is running (e.g.,
playerScore = 10). - A constant is a named memory location whose value cannot change while the program is running (e.g.,
PI = 3.14159).
Why use constants? They make code more readable and easier to maintain. If a fixed value changes in the future (like a VAT rate), you only have to update it in one place at the top of your code, rather than hunting through hundreds of lines.
Concept 3: Subprograms (Procedures vs Functions)
As programs get larger, they become harder to read and debug. We solve this by breaking them down into smaller, reusable blocks called subprograms.
Open full-size image (opens in a new tab)
There is a critical distinction examiners test every year:
- Procedures: Perform a specific task but do not return a value to the main program. (e.g., clearing the screen).
- Functions: Perform a specific task and return a value to the main program using a
returnstatement. (e.g., calculating an area and returning the result).
Both can accept parameters—values passed into the subprogram to give it the data it needs to work.
Concept 4: Variable Scope (Global vs Local)
Where you declare a variable determines where it can be used.
Open full-size image (opens in a new tab)
- Global Variables: Declared outside any subprogram. They can be accessed and modified from anywhere in the entire program.
- Local Variables: Declared inside a specific subprogram. They can only be accessed within that subprogram and are destroyed when the subprogram finishes running.
Examiner Tip: Always prefer local variables! They keep subprograms self-contained and prevent accidental changes to data from other parts of the program.
Podcast Episode
Listen to our 10-minute revision podcast covering all the core concepts, common exam mistakes, and a quick-fire recall quiz!
Check what you remember
Read the wording for your board, then hide it and explain Sequence in your own words. Rough notes are fine. This is a self-check, with no mark or grade.
Reference: Pearson Edexcel
The execution of statements one after another, in the order they are written.
Interactive Diagrams
2 interactive diagrams to visualise key concepts
Conceptual Flow Outline
A flowchart demonstrating the Selection construct using a condition.
Conceptual Flow Outline
A flowchart demonstrating Condition-Controlled Iteration (a while loop).
Worked Examples
3 worked examples — open one to explore the question and available guidance.
Practice Questions
Try the question, then reveal an answer plan or example response
Identify the programming construct used in the following code: for i in range(10): print(i)
Hint: Look at the keyword 'for'. Does it make a decision, or does it repeat?
State two advantages of using subprograms in a large software project.
Hint: Think about what happens if you find a bug, or if multiple people are working on the code.
A student has written a program with a variable total declared inside a function called calculate(). They try to print(total) in the main program, but get an error. Explain why.
Hint: Think about the scope of the variable total.
Write a function called is_even that takes an integer as a parameter and returns True if the number is even, and False if it is odd.
Hint: You will need to use the modulo operator (MOD or %) to check for a remainder when divided by 2.
Explain the difference between count-controlled iteration and condition-controlled iteration, giving an example of when you would use each.
Hint: Compare 'for' loops with 'while' loops based on what you know *before* the loop starts.
Ready to test yourself interactively?
Active recall beats reading alone. Answer questions on Constructs with instant AI scoring and mark scheme guidance.
A week of Premium from your first lesson · Then the free plan continues · No card, no charge
Exam technique
How to turn what you know into marks
How to approach the question
When asked to write code, always draft a quick flowchart or bulleted list first. Identify which constructs (SSI) you need before writing syntax. Check your loops to ensure they don't run infinitely.
How to structure your answer
For code writing: Declare variables -> Get inputs -> Process (SSI) -> Output. For theory questions: Define the term -> Give an example -> Explain why it is used.
Timing
Approximately 1 minute per mark. A 6-mark algorithm question should take about 6-7 minutes.
Common pitfalls
- Confusing '=' (assignment) with '==' (comparison) in IF statements.
- Writing a function but forgetting to include the 'return' statement at the end.
- Creating an infinite loop by forgetting to update the condition variable inside a while loop.
What the command words want
- Compare
- Identify similarities AND differences. E.g., 'Both procedures and functions are subprograms, BUT functions return a value while procedures do not.'
- Explain
- Say HOW or WHY. Use 'because' to link your point to a reason.
- Describe
- Set out characteristics. If asked to describe a function, state what it does and that it returns a value.
- State/Give
- Provide a brief factual answer - usually 1 sentence or just the keyword.
- Write/Output
- Produce code or pseudocode. Focus on logic over perfect syntax, but ensure indentation is clear.
Watch or listen (optional)
Test your understanding of Constructs
Active recall beats re-reading. Take an instant quiz now to test what you’ve learned and lock it into long-term memory.
A week of Premium from your first lesson · Then the free plan continues · No card, no charge