levo

Programming Fundamentals

Sequence, selection and iteration

  • 3 things to know
  • J277/02

Overview

The three programming constructs, count-controlled and condition-controlled loops, the output of for, while and do … until loops, if … elseif, and switch … case.

What you need to know

Answer each one before you reveal it.

Your recallNot started
Key term

Name the three basic programming constructs that control the flow of a program.

Process

What is sequence in a program?

Key term

What is selection?

Questions from this subtopic

Each one with the model answer underneath.

  1. 1

    Name the three basic programming constructs that control the flow of a program.

    Model answer

    The three constructs are sequence, selection and iteration. Every program can be built from these three.

  2. 2

    What is sequence in a program?

    Model answer

    Sequence means instructions are carried out one after another in the order they are written. Changing the order can change the result.

  3. 3

    What is selection?

    Model answer

    Selection uses a condition to decide which block of code runs. The if statement and the switch statement both perform selection.

  4. 4

    What is iteration?

    Model answer

    Iteration repeats a block of code. The repetition continues a set number of times or until a condition is met.

  5. 5

    What is the difference between a count-controlled loop and a condition-controlled loop?

    Model answer

    A count-controlled loop repeats a fixed number of times, like a for loop. A condition-controlled loop repeats until a condition changes, like a while loop.

  6. 6

    How many times is Hi printed by for i = 3 to 7, print("Hi"), next i?

    Model answer

    The word Hi is printed 5 times. The variable i takes the values 3, 4, 5, 6 and 7, and both ends are included.

Other ways to work this

The same content, four other ways.

What is inside Levo

Six ways to work the same material.

1Closed book
2Open book
3Closed book

The 3-step method, run for you

Answer cold, learn it, then prove it stuck. Levo tracks the jump between your first attempt and your last.

Systems Architecture
Memory and Storage
Computer Networks, Connections and Protocols
Network Security

Cram a whole paper in one sitting

Sort every topic into what you know and what you do not, then drill only the weak ones.

A bit is the unit of data.
smallestlargestmain

Blank Blitz makes facts automatic

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

AThe sum 0 + 0 is 0, and 0 + 1 is 1.
BThe sum 1 + 1 is 0 carry 1.
CThe sum 1 + 1 + 1 is 1 carry 1.

Build It gets the exam shape right

Assemble a full-mark answer from its marking points, in the order an examiner wants them.

Integer means a whole number with no fractional part.
TrueFalse

Test It catches misconceptions

Spot the fault in a statement. The traps are the mistakes students actually make.

721941163128510

Brain Breaks between sessions

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

Every question in Programming Fundamentals, on a schedule.

Attempt a question from memory, write the correct version, then attempt it again. Levo records the jump between your first attempt and your last, and brings each question back on the day you are due to forget it.

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