Programming Fundamentals
Aligned to the OCR J277 specification
- Level
- Intermediate
- Reading time
- 6 min
- Published
- 11 June 2026
- Updated
- 1 July 2026
On this page
Key takeaways
- The three programming constructs are sequence (instructions run in order), selection (IF/ELIF/ELSE branches on a condition), and iteration (FOR count-controlled loops and WHILE condition-controlled loops).
- A variable's value can change at runtime; a constant is set once and never changes, making programs easier to maintain if the value needs updating.
- MOD gives the remainder of division (17 MOD 5 = 2); DIV gives the whole-number quotient (17 DIV 5 = 3).
- A WHILE loop checks its condition before each iteration; if the condition is False on the first check the loop body runs zero times. The variable in the condition must be updated inside the loop or an infinite loop results.
- A common mistake: = is assignment (stores a value); == is comparison (checks equality). Using = inside an IF condition is a syntax error in most languages.
Worth saving these ideas?
Turn what you've read into instant revision cards. Free to get started.
Key terms
- Variable
- A named storage location in memory whose value can change while the program is running.
- Constant
- A named value that is set once before the program runs and does not change during execution, typically written in ALL_CAPS.
- Assignment
- An instruction that stores a value or expression result in a variable. The variable name is on the left and the value on the right, for example: x = 5.
- Sequence
- The programming construct where instructions execute one after another in the order they are written.
- Selection
- The programming construct that chooses between different execution paths based on whether a condition evaluates to True or False, using IF/ELIF/ELSE.
- Iteration
- The programming construct that repeats a block of code, either a fixed number of times (count-controlled) or while a condition holds (condition-controlled).
- FOR loop
- A count-controlled loop that runs a set number of times, determined by a counter variable that steps through a defined range.
- WHILE loop
- A condition-controlled loop that repeats while a condition is True. The condition is checked before each iteration.
- MOD
- An arithmetic operator that returns the remainder of integer division, for example 17 MOD 5 = 2.
- DIV
- An arithmetic operator that returns the whole-number quotient of integer division, for example 17 DIV 5 = 3.
- Boolean operator
- An operator (AND, OR, NOT) that combines or negates Boolean expressions to produce a True or False result.
Frequently asked questions
A count-controlled loop (FOR) runs a fixed number of times determined before it starts. A condition-controlled loop (WHILE) repeats while a condition remains True, so the number of repetitions is not known in advance and depends on data or user input.
MOD gives the remainder after integer division: 17 MOD 5 = 2. DIV gives the whole-number quotient: 17 DIV 5 = 3. A common mistake is mixing them up - MOD does not give the whole number part.
A variable is a named storage location whose value can change while the program runs. A constant is named once and its value never changes during execution. Constants are typically written in ALL_CAPS and make programs easier to maintain.
Generate revision on any topic you study
Type any topic you're studying and Aicademy generates a complete lesson, quiz, and flashcard set, personalised to your level.
Lessons on anything
Structured, level-matched lessons on any topic you study
Practice quizzes
Find out what you actually know before the exam does
Flashcard sets
Lock in key concepts with instant revision cards
Ask Aica
Stuck on something? Get a clear explanation, any time
Sorting Algorithms
Data Types and Casting
Related lessons
7 min
7 min
7 min