GCSE Algorithms and Programming 2 — Questions and Answers
Question 1: In programming, what term describes instructions being executed one after another in the order they are written?
- Sequence (Correct answer)
- Selection
- Iteration
- Decomposition
Correct answer: Sequence
Sequence is one of the three basic programming constructs, alongside selection and iteration.
Sequence means that a program's instructions run one after another, in the exact order they appear in the code, unless a selection or iteration structure changes that order.
Question 2: Which programming construct uses IF/ELSE statements to make decisions based on conditions?
- Selection (Correct answer)
- Sequence
- Iteration
- Abstraction
Correct answer: Selection
Selection allows a program to choose between different paths of execution depending on whether a condition is true or false.
Selection statements, such as IF, ELSE IF, and ELSE, let a program execute different blocks of code depending on the outcome of a Boolean condition, enabling programs to respond differently to different inputs.
Question 3: Which programming construct repeats a block of instructions, such as through a FOR loop or WHILE loop?
- Iteration (Correct answer)
- Sequence
- Selection
- Decomposition
Correct answer: Iteration
Iteration repeats a set of instructions either a fixed number of times or until a condition is met.
Iteration is essential for tasks like processing every item in a list or repeating a calculation until a target is reached, and includes count-controlled loops (FOR) and condition-controlled loops (WHILE).
Question 4: What is a named location in a computer's memory used to store a value that can change while a program runs called?
- A variable (Correct answer)
- A constant
- An algorithm
- A flowchart
Correct answer: A variable
A variable stores data that can be read and updated as the program executes.
Variables are given identifiers (names) so a program can refer to and manipulate the value stored in them; their value can be reassigned during execution, unlike a constant, which stays fixed.
Question 5: Which data type is used to store whole numbers, such as 5 or -12, with no decimal point?
- Integer (Correct answer)
- Real/Float
- String
- Boolean
Correct answer: Integer
Integer data types store whole numbers without any fractional or decimal component.
Choosing the correct data type matters for both storage efficiency and correct program behaviour; an integer cannot store decimal values, which instead require a real (float) data type.
Question 6: Which data type can only hold one of two values, True or False?
- Boolean (Correct answer)
- Integer
- String
- Real/Float
Correct answer: Boolean
A Boolean data type stores a binary value representing True or False.
Boolean variables are commonly used to control selection and iteration, for example storing the result of a comparison such as whether a score is greater than a pass mark, which drives IF statements or loop conditions.
In programming, what term describes instructions being executed one after another in the order they are written?