GCSE Computer Science 2 — Questions and Answers
Question 1: What is an algorithm?
- A type of programming language
- A step-by-step set of instructions designed to solve a problem (Correct answer)
- A piece of computer hardware
- A method of storing data in a database
Correct answer: A step-by-step set of instructions designed to solve a problem
An algorithm is a finite, ordered sequence of well-defined instructions used to solve a problem or complete a task.
Question 2: Which of the following best describes a 'for loop' in programming?
- It runs indefinitely until manually stopped
- It executes a block of code a specific number of times (Correct answer)
- It only executes if a condition is true at runtime
- It is used exclusively to define new functions
Correct answer: It executes a block of code a specific number of times
A for loop iterates a block of code a predetermined number of times, controlled by a counter variable.
Question 3: What does 'decomposition' mean in computational thinking?
- Finding repeating patterns in a data set
- Writing pseudocode before real code
- Breaking a complex problem into smaller, more manageable sub-problems (Correct answer)
- Combining multiple sorting algorithms
Correct answer: Breaking a complex problem into smaller, more manageable sub-problems
Decomposition is the process of breaking a large, complex problem into smaller parts that are easier to understand and solve.
Question 4: Which sorting algorithm works by repeatedly comparing and 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 passes through the list repeatedly, swapping neighboring elements until the entire list is sorted.
Question 5: What is an array in programming?
- A single variable holding one value at a time
- A data structure that stores multiple values of the same type under one name (Correct answer)
- A type of conditional statement
- A loop that iterates over characters in a string
Correct answer: A data structure that stores multiple values of the same type under one name
An array stores a collection of elements of the same data type, accessed using an index.
Question 6: What is the purpose of using functions (subroutines) in a program?
- To make programs run slower for testing
- To prevent the use of variables
- To group reusable blocks of code that can be called multiple times (Correct answer)
- To store data permanently on disk
Correct answer: To group reusable blocks of code that can be called multiple times
Functions allow programmers to write a block of code once and call it whenever needed, promoting reusability and reducing repetition.
Question 7: What is the output of the following pseudocode? x ← 10 x ← x * 2 x ← x - 5 OUTPUT x
- 10
- 20
- 15 (Correct answer)
- 5
Correct answer: 15
x starts at 10, is multiplied by 2 to give 20, then 5 is subtracted leaving 15.