Online worksheet ยท 2 of 4
The condition must eventually change - Online practice 2
Read the information, then answer the questions. An adult may read the instructions aloud. Show your working where asked.
Read before answering
Paper loop: initialise count = 1; while count < 5, update count = count + 1, then print(count). Retest the condition before each next iteration. A strict less-than boundary need not be reached exactly if the step skips over it. Do not run the deliberately broken no-update version.
Worksheet preview
- List outputs and the final count for start 1, limit 5, step 1.
- How many times does this loop body execute? Why does it stop?
- If the update is removed, will the loop necessarily terminate from start 1 with condition count < 5?
This exercise is included in the free preview. Register free to complete it and download the preview PDFs. No payment is required.
Already registered? Sign in