OCR GCSE Computer Science J277
Systems Architecture
Memory and Storage
Computer Networks, Connections and Protocols
Network Security
Systems Software
Ethical, Legal, Cultural and Environmental Impacts of Digital Technology
Algorithms
Programming Fundamentals
Producing Robust Programs
Programming Languages and Integrated Development Environments
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.
What is sequence in a program?
What is selection?
Questions from this subtopic
Each one with the model answer underneath.
- 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
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
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
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
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
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.
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.