What are the three programming constructs, and how do you use selection and the two kinds of iteration?
The three programming constructs: sequence, selection (if and nested if) and iteration (count-controlled and condition-controlled loops), and when to use each.
An Eduqas GCSE Computer Science answer on the three programming constructs: sequence, selection (if, else, nested if) and iteration (count-controlled for loops and condition-controlled while loops), with worked pseudocode for each.
Reviewed by: AI editorial process; not yet individually human-reviewed
Have a quick question? Jump to the Q&A page
Jump to a section
What this dot point is asking
Eduqas wants you to use the three programming constructs: sequence, selection and iteration. You must know selection with if, else and nested if, and the two kinds of iteration (count-controlled for loops and condition-controlled while loops), and choose the right one for a task. These constructs are the backbone of every Component 2 program.
Sequence
Selection
A grading example with if/elseif/else:
if mark >= 70 then
grade = "A"
elseif mark >= 50 then
grade = "B"
elseif mark >= 40 then
grade = "C"
else
grade = "U"
endif
Iteration
Try this
Q1. Name the three programming constructs. [1 mark]
- Cue. Sequence, selection and iteration.
Q2. State which kind of loop you would use to repeat a block exactly 20 times. [1 mark]
- Cue. A count-controlled loop (a
forloop).
Q3. State one difference between a count-controlled and a condition-controlled loop. [1 mark]
- Cue. A count-controlled loop repeats a fixed, known number of times; a condition-controlled loop repeats an unknown number of times while a condition holds.
Exam-style practice questions
Practice questions written in the style of WJEC Eduqas exam questions on this dot point, with worked answer explainers. The year tag is the paper they imitate, not the source.
Eduqas Component 1, 20224 marksExplain the difference between a count-controlled loop and a condition-controlled loop, and give an example of when each is the better choice.Show worked answer →
Count-controlled loop (up to 2): repeats a fixed, known number of times using a counter (a for loop). Example: printing the twelve rows of a times table, where you know there are exactly twelve.
Condition-controlled loop (up to 2): repeats while (or until) a condition is met, when the number of repetitions is not known in advance (a while loop). Example: asking a user to enter a password until it is correct, where you do not know how many tries it will take.
Markers reward the known-versus-unknown number of repetitions distinction and a sensible example for each. Saying "for loops are faster" misses the point.
Eduqas Component 1, 20235 marksWrite an algorithm that reads a whole number and outputs whether it is positive, negative or zero, using selection.Show worked answer →
Read the number, then use if/elseif/else to test the three cases.
input n; if n > 0 then output "positive" elseif n < 0 then output "negative" else output "zero" endif.
Marks: input (1), correct condition n > 0 with "positive" (1), correct elseif n < 0 with "negative" (1), else "zero" for the remaining case (1), correct structure and order (1).
Markers reward handling all three cases with the else catching zero. Using two separate ifs that could both run, or missing the zero case, loses marks.
Related dot points
- The purpose and functions of an operating system (memory management, multitasking, peripheral management, the user interface, and security and user management) and the role of common utility software.
An Eduqas GCSE Computer Science answer on the purpose and functions of an operating system (memory management, multitasking, peripheral management, the user interface, security and user management) and the role of common utility software.
- High-level and low-level languages, machine code and assembly language, the three translators (compiler, interpreter and assembler), and the features of an integrated development environment (IDE).
An Eduqas GCSE Computer Science answer on high-level versus low-level languages, machine code and assembly, the three translators (compiler, interpreter, assembler) with their differences, and the features of an integrated development environment.
- Variables and constants, the common data types (integer, real, Boolean, character, string), and the arithmetic, relational and logical operators used in programs.
An Eduqas GCSE Computer Science answer on variables and constants, the common data types (integer, real, Boolean, character, string), and the arithmetic, relational and logical operators, including integer division and modulus.
- Arrays as a data structure: declaring and using one-dimensional arrays, accessing elements by index, and iterating through an array with a loop, with awareness of two-dimensional arrays.
An Eduqas GCSE Computer Science answer on arrays as a data structure: declaring and using one-dimensional arrays, accessing elements by index, iterating through an array with a loop, and awareness of two-dimensional arrays.
- Subprograms (procedures and functions), the difference between them, parameters and arguments, local and global variables, and why subprograms make programs easier to write and maintain.
An Eduqas GCSE Computer Science answer on subprograms: the difference between a procedure and a function, parameters and arguments, local and global variables, and why subprograms support decomposition, reuse and easier maintenance.
Sources & how we know this
- WJEC Eduqas GCSE Computer Science specification (from 2016) — Eduqas (2020)