What is a Programming Construct?
- A programming construct determines the order in which lines of code are executed
- They control logic and behaviour of code
- There are three core programming constructs:
- Sequence
- Selection
- Iteration
Author
Robert HamptonExpertise
Computer Science Content Creator
Line | OCR reference language/Python |
01 | print("Enter the first number") |
02 | Num1 = input() |
03 | print("Enter the second number") |
04 | Num2 = input() |
05 | Result = Num1 - Num2 |
06 | print(Result) |
Concept | OCR exam reference | Python |
IF-THEN-ELSE |
|
|
CASE SELECT or SWITCH |
|
|
Iteration | OCR exam reference | Python |
FOR loop (Count controlled) |
|
|
This will print the word "Hello" 10 times (0-9 inclusive) | ||
|
|
|
This will print the even numbers from 2 to 10 inclusive | ||
|
|
|
This will print the numbers from 10 to 0 inclusive | ||
WHILE loop (Condition controlled) |
|
|
This will loop until the user inputs the colour "Red". Check condition is carried out before entering loop | ||
DO WHILE loop (Condition controlled) |
|
# Not used in Python |
This will loop until the user inputs the colour "Red". Loop iterates once before a check is carried out |
Tick (✓) one box in each row to identify whether each programming construct has or has not been used in the program [3]
total = 0
for i = 1 to 5
num = input("Enter a number")
total = total + num
next i
print(total)
Has been used | Has not been used | |
Sequence | ||
Selection | ||
Iteration |
How to answer this question
Answer
Has been used | Has not been used | |
Sequence | ||
Selection | ||
Iteration |
to absolutely everything:
Did this page help you?
Rob has over 16 years' experience teaching Computer Science and ICT at KS3 & GCSE levels. Rob has demonstrated strong leadership as Head of Department since 2012 and previously supported teacher development as a Specialist Leader of Education, empowering departments to excel in Computer Science. Beyond his tech expertise, Robert embraces the virtual world as an avid gamer, conquering digital battlefields when he's not coding.