GCSE GCSE Computer Science 2 — Questions and Answers
Question 1: What is an algorithm?
- A type of computer virus
- A step-by-step set of instructions to solve a problem (Correct answer)
- A programming language
- A type of database
Correct answer: A step-by-step set of instructions to solve a problem
An algorithm is a precise, ordered set of instructions designed to solve a specific problem or perform a task.
Question 2: Which sorting algorithm works by repeatedly swapping adjacent elements that are in the wrong order?
- Merge sort
- Insertion sort
- Bubble sort (Correct answer)
- Quick sort
Correct answer: Bubble sort
Bubble sort repeatedly compares and swaps neighbouring elements until the entire list is in the correct order.
Question 3: What does 'iteration' mean in the context of programming?
- Declaring a variable
- Repeating a block of code (Correct answer)
- Defining a function
- Importing a module
Correct answer: Repeating a block of code
Iteration refers to the repetition of a block of code, typically implemented using loops such as for or while.
Question 4: In Python, which operator is used for integer (floor) division?
- /
- %
- // (Correct answer)
- **
Correct answer: //
The // operator in Python performs integer division, dividing and discarding any remainder to return a whole number.
Question 5: What is a subroutine in programming?
- A type of data structure
- A named block of code that can be called multiple times (Correct answer)
- A comment written in code
- A variable declaration
Correct answer: A named block of code that can be called multiple times
A subroutine is a named, reusable block of code that performs a specific task and can be called from anywhere in a program.
Question 6: What does 'selection' refer to in programming?
- Repeating a set of instructions
- Storing data in a variable
- Making decisions using conditions such as IF statements (Correct answer)
- Defining a list or array
Correct answer: Making decisions using conditions such as IF statements
Selection is a programming construct that uses conditions (IF, ELSE IF, ELSE) to choose between different execution paths.
Question 7: Which data type is used to store the value True or False?
- Integer
- String
- Float
- Boolean (Correct answer)
Correct answer: Boolean
A Boolean data type stores only two values — True or False — and is used for logical conditions and decision-making.