levo

Program Control Structures

Choosing and evaluating control structures

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

Overview

Three measures of a well-chosen control structure and structured programming.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Evaluation

Evaluate the choice between a switch and an else-if ladder for a menu of six numbered options.

Key term

What is structured programming, and what does the single entry and single exit principle require?

Key term

Compare a loop that tests before the body with one that tests after, and give a case that suits each.

Questions from this subtopic

Each one with the model answer underneath.

  1. 1

    Which control structure suits a task where an action is taken only for certain data values?

    Model answer

    Selection suits that task, because selection evaluates a condition and executes the statements only when the condition holds.

  2. 2

    Which loop structure suits a fixed number of passes, and which suits a number decided by the data?

    Model answer

    A counted for loop suits a fixed number of passes, and a while or do while loop suits a number of passes decided by the data as the loop runs.

  3. 3

    Evaluate the choice between a switch and an else-if ladder for a menu of six numbered options.

    Model answer

    A switch is the better choice, because the six options are distinct constant values, the tested variable is written once, and adding a seventh option is a single new case; an else-if ladder would repeat the comparison six times.

  4. 4

    Why does replacing ten near-identical copied statements with a loop reduce defects?

    Model answer

    The logic then exists in one place, so a correction is made once rather than ten times and there is no risk that one of the copies is missed or edited differently.

  5. 5

    What are three measures of a well-chosen control structure?

    Model answer

    A well-chosen structure expresses the intention plainly to a reader, behaves correctly at the boundary values of its data, and does no more work than the task requires.

  6. 6

    What is structured programming, and what does the single entry and single exit principle require?

    Model answer

    Structured programming builds a program only from sequence, selection and repetition, and the principle requires each such block to be entered at one point and left at one point, so a block can be reasoned about as a single step.

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.

Software and the Development Environment
Defining Data: Types, Variables and Classes
Program Control Structures
Objects, Classes and Data Structures

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 null is the of one.
absencepresencetype

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.

An error is the mistake a person made.
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 Program Control Structures, 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.