Exam-style question
Try this first
Explain the three combining principles used in imperative programs: sequence, iteration and selection. Then explain the difference between definite iteration and indefinite iteration, including the difference between a condition at the start and a condition at the end of an iterative structure.
Model answer
What a good answer should say
- Sequence means that statements are executed in the order in which they appear.
- Selection chooses between alternative paths depending on a condition.
- Iteration repeats a statement or group of statements.
- Definite iteration has a known or controlled number of repetitions, such as a Python 3 for loop over a range.
Explanation
Why this works
A strong answer identifies all three principles and explains their roles rather than merely naming them. It also distinguishes the number-controlled nature of definite iteration from the condition-controlled nature of indefinite iteration, and explains the important theoretical difference between testing before and after the loop body.
Common mistake
No common mistake is linked to this question yet.
