levo

Programming

Iteration: count-controlled and condition-controlled loops

  • 3 things to know
  • AS Unit 1
Start revising · £5/month

Overview

Count-controlled loop, condition-controlled loop and pre-conditioned and a post-conditioned loop.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Key term

What is a count-controlled loop?

Key term

Distinguish between a pre-conditioned and a post-conditioned loop.

Key term

What is an infinite loop, and give one common cause of one.

Questions from this subtopic

Each one with the model answer underneath.

  1. 1

    What is meant by iteration?

    Model answer

    Iteration is a construct that makes a block of statements repeat, so that the same instructions can be applied many times without being written out again.

  2. 2

    What is a count-controlled loop?

    Model answer

    A count-controlled loop repeats its body a fixed number of times, governed by a counter variable that is set to a starting value, changed on every pass and tested against a limit.

  3. 3

    Which statement normally provides a count-controlled loop?

    Model answer

    The FOR statement provides a count-controlled loop in most programming languages.

  4. 4

    What is a condition-controlled loop?

    Model answer

    A condition-controlled loop repeats its body for as long as a stated condition holds, and the number of repetitions is not known when the program is written.

  5. 5

    Distinguish between a pre-conditioned and a post-conditioned loop.

    Model answer

    A pre-conditioned loop tests its condition before the body, so the body may be skipped altogether, while a post-conditioned loop tests after the body, so the body always runs at least once.

  6. 6

    Which kind of loop suits the validation of an input, and why?

    Model answer

    A post-conditioned loop such as REPEAT UNTIL suits validation, because a value has to be entered once before it can be judged, and the loop then repeats only while the entry remains unacceptable.

Other ways to work this

The same content, four other ways.

Everything in your subscription

Runs, plus a mode for every other kind of session.

1Flash
2Imposter
3Fade
4Brain dump

Learn every subtopic in runs of four questions

Facts flash and fade, a wrong word hides in some of them, and a brain dump decides which questions are locked in.

Systems Analysis and Development Approaches
Design, Development and Testing
Implementation and System Security
Programming

Cram the night before, weakest topic first

A quick scan finds your weakest topics. Recall each fact you missed three times in a row.

A check requires a value.
presencerangeformat

Blank Blitz consolidates the facts

Rapid timed gap-fills on the terms and numbers you need to recall without thinking.

✓What it iscovered
~Why it happenspartly there
How long it lastsnot there yet

Explain It tests your understanding

Explain a concept in your own words and see which of its points you covered.

One byte is made up of 8 bits.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The faults are the mistakes students make most often.

721941163128510

Brain Breaks between sessions

Short focus games to reset attention, so the next set lands better than the last.

Every question in Programming, on a schedule.

Learn it in runs of four questions, each ending on a brain dump against the clock. Every question you lock in comes back the next day, then at longer gaps, each time just before you would forget it.

Or £46 a year, about £3.83 a month. Cancel anytime.