Online worksheet ยท 3 of 4

The condition must eventually change - Online practice 3

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 = 2; while count < 8, update count = count + 2, 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

  1. List outputs and the final count for start 2, limit 8, step 2.
  2. How many times does this loop body execute? Why does it stop?
  3. If the update is removed, will the loop necessarily terminate from start 2 with condition count < 8?

This exercise is included in the free preview. Register free to complete it and download the preview PDFs. No payment is required.

Register free

Already registered? Sign in