DoRevision

Programming Constructs and Development

The three programming constructs (sequence, selection and iteration), how a condition drives a program, and the development process of writing, testing and debugging a program before evaluating it.

⏱️ 20 min 🎯 15 activities
Best used for
Intervention Mock preparation Cover lesson

Justify the choices, the way you are assessed

Free interactive practice on the decisions the assessment actually asks you to justify.

Start revising free

What you'll cover

Building programs from constructs

Every program, however large, is built from a few simple building blocks called constructs. There are three of them. Sequence means carrying out instructions one after another, in the order they are written. Selection means choosing between different paths, so the program does one thing in one case and something else in another. Iteration means repeating a set of instructions, either a fixed number of times or for as long as something stays true. Selection and iteration both rely on a condition, which is a question the program checks as it runs. Once you can write with these three constructs, the next skill is the development process: designing the program, writing it, testing it with different inputs, finding and fixing any mistakes, and finally judging how well it works. This module covers both the constructs and that process.

Construct and development words

Learn these terms before the constructs are matched up. They name the ideas used in this topic.

Match each construct to what it does

  • sequence
  • selection
  • iteration
  • a condition
  • debugging
  • runs instructions in order, one after another
  • chooses a path depending on a test
  • repeats instructions while something stays true
  • a test that is either true or false
  • finding and fixing mistakes in the code

Selection against iteration

Selection and iteration both use a condition, but they do very different jobs, and mixing them up is a common mistake.

Which construct is this?

A program must keep asking for a password until the correct one is typed in. Which construct does it use?

  • Iteration, because it repeats until a condition is met
  • Selection
  • Sequence
  • A variable

Test as you build

A good programmer does not write the whole program and then hope it works. They test as they go, running small parts and checking the result before moving on. When something goes wrong, they change one thing at a time so they can see what fixed it. They try the program with different inputs, including odd ones such as a blank entry or a very large number, because those are where mistakes hide. They also check what the program does at the edges, like the very first and very last item in a list. Testing early and often turns a big, frightening pile of errors into a series of small, easy fixes, and it gives you the evidence you need when you come to judge how well the program works.

Pick what is true about program flow

Select every statement about programming constructs that is true.

  • Sequence runs instructions in the order written
  • Selection chooses a path using a condition
  • Iteration repeats a block of instructions
  • A program can only ever run one instruction
  • Constructs are never used together

Order the steps of developing a program

Put the stages of developing a program into a sensible order.

  • Design what the program must do
  • Write the code using the constructs
  • Test it with different inputs
  • Find and fix any mistakes
  • Evaluate how well it works

Complete the sentences about constructs

Carrying out instructions one after another in the order written is called _____. Choosing between different paths depending on a condition is called _____. Repeating a set of instructions over and over is called _____. Finding and fixing the mistakes in a program is called _____.

sequence selection iteration debugging variable flowchart

Tap the two that repeat

Read these four program behaviours. Tap the TWO that use iteration.

  • count down from ten to one
  • greet each name in a list
  • show a prize only if the score is high
  • store the players name once

Your morning routine as a program

Think of your morning as a program you run every day. First you do the same things in a fixed order: alarm, get up, wash, dress, eat. That fixed order is the first idea. Then you make choices along the way: if it is raining you grab a coat, if it is sunny you leave it behind, so the same morning takes different paths on different days. And some things you do again and again: you might hit snooze once more, and once more, until you finally get up. If you get to the door and realise you forgot your keys, you stop, work out what went wrong, go back and fix it before carrying on. A program works in exactly these ways, running steps in turn, making choices, repeating actions and having its mistakes traced and put right.

Count the loop repeats

A loop runs 4 times. Each time it runs, an inner loop repeats 3 times. In total, how many times does the inner step run? Give the number only.

Pick the construct for each job

Read each situation and choose the best construct.

  • A program should print a message for every pupil in a class of thirty. Which construct fits?
  • A program should show a warning only when a temperature reading is too high. Which construct fits?
  • The program keeps crashing on one line. What should the programmer do?

Build a point about program flow

Choose the word for each gap to complete one point about programming constructs.

Explain constructs and development

A friend is starting to write their first program. Using what you have learned, explain the constructs and the development process.

  • Explain what sequence means
  • Explain how selection uses a condition
  • Explain what iteration does and when to use it
  • Explain why testing with different inputs matters
  • Explain what debugging is and how to go about it