Component 2: Computational Thinking, Algorithms and Programming GCSE Computer Science Worksheets, Questions and Revision
11 original Component 2: Computational Thinking, Algorithms and Programming worksheet packs - 119 printable pages with full mark schemes. Algorithms, programming fundamentals, Boolean logic, data representation and SQL. View any pack in the browser or open the print-ready PDF.
- packs
- 11
- question pages
- 89
- printable pages
- 119
- 2.1Algorithms
- Full PackRevise this topic: Data Representation: Number Systems
More formats: Data Representation: Number Systems
- Full PackRevise this topic: Data Representation: Images, Sound and Compression
More formats: Data Representation: Images, Sound and Compression
- Full PackRevise this topic: Programming Practice: Writing and Refining Programs
More formats: Programming Practice: Writing and Refining Programs
- Full PackRevise this topic: Trace Tables and Binary/Hex Conversions
More formats: Trace Tables and Binary/Hex Conversions
- Full PackRevise this topic: Translators and Integrated Development Environments (IDEs)
More formats: Translators and Integrated Development Environments (IDEs)
- Full PackRevise this topic: 1D and 2D Array Processing: Writing and Tracing Programs
More formats: 1D and 2D Array Processing: Writing and Tracing Programs
Free for personal and classroom use - see copyright & terms.
An array called nums contains the values [4, 1, 7, 3], to be sorted into ascending order using a bubble sort that compares and swaps adjacent items. Show the state of the array after each comparison in the first full pass.
- Compare index 0 and 1 (4 and 1): 4 is greater than 1, so swap, giving [1, 4, 7, 3].
- Compare index 1 and 2 (4 and 7): 4 is not greater than 7, so no swap, array stays [1, 4, 7, 3].
- Compare index 2 and 3 (7 and 3): 7 is greater than 3, so swap, giving [1, 4, 3, 7].
- Final answer: after the first pass, the array is [1, 4, 3, 7].
How to work through Component 2 computer science
This component brings together computational thinking, algorithms, programming and data representation. Listed material includes decomposition and abstraction, flowcharts and pseudocode, linear and binary search, bubble, insertion and merge sort, variables and data types, selection and iteration, subroutines, arrays, Boolean logic, validation, binary and hexadecimal, image and sound data, SQL, trace tables and language translation. Start with the topic that matches the problem, then connect it to the relevant method. A search question asks how values are checked, while a programming trace asks how state changes as instructions run.
Before checking an answer, make your own trace. Copy the starting values, label any indices or variables, and move through one comparison, instruction or loop pass at a time. Record every change where it happens and leave unchanged values visible. For a search, note the item checked and which part remains; for a sort, rewrite the full list after each swap or insertion; for code, track variables and the condition that controls the next step. At the end, compare your first differing line with the worked steps. This shows whether the issue began with reading an index, applying a condition or carrying a value forward.
Use the listed practice questions for a first check, then use an exam-style item when you want to practise a longer response or trace. Try it with the answer hidden. Compare each part of your working with the answer and mark scheme, awarding yourself only the points supported by what you wrote. A mark scheme can show which distinct facts or intermediate results are credited; it is also a way to locate a missing step, not just confirm a final value. Return to the explanation for that step and attempt the question again from a blank trace.
Break problems down and trace algorithms
Decomposition means breaking a large problem into smaller, manageable sub-problems. Abstraction means setting aside detail that does not matter to the task. Use these ideas to identify the inputs, decisions and outputs before writing an algorithm. Flowcharts show the sequence and branches with symbols, while pseudocode expresses those steps in a compact written form. Read a branch by checking its condition and following only the route that condition selects.
For searching, linear search checks items in sequence until it finds the target or reaches the end. Binary search repeatedly checks a middle item and discards half of the remaining range, so its input must already be sorted. Keep lower and upper indices in a trace and calculate the midpoint as instructed. Sorting methods make different changes: bubble sort compares adjacent items and swaps out-of-order pairs, insertion sort puts each new item into its place in a sorted part, and merge sort splits lists before merging sorted parts. Show the list after each operation so the order can be checked.
Worked example. An array called nums contains the values [4, 1, 7, 3], to be sorted into ascending order using a bubble sort that compares and swaps adjacent items. Show the state of the array after each comparison in the first full pass.
- Compare index 0 and 1 (4 and 1): 4 is greater than 1, so swap, giving [1, 4, 7, 3].
- Compare index 1 and 2 (4 and 7): 4 is not greater than 7, so no swap, array stays [1, 4, 7, 3].
- Compare index 2 and 3 (7 and 3): 7 is greater than 3, so swap, giving [1, 4, 3, 7].
- Final answer: after the first pass, the array is [1, 4, 3, 7].
Answer: [1, 4, 3, 7]
Follow program state and check logic
Programming fundamentals include data types, variables and constants, operators, sequence, selection and iteration. In a trace table, write the initial values, then update a variable only when an instruction changes it. For each loop pass, record the condition, the values used, and the values after the statements run. Check what happens when the condition becomes false as well as what happens during the repeating passes. Procedures and functions organise steps for reuse; parameters carry values into a subroutine, and a returned value can be used by the calling code.
Arrays keep related values under one name, with an index identifying an item; a two-dimensional array uses row and column positions. Boolean logic combines True and False values using operators such as AND, OR and NOT. Evaluate each part of a condition before applying it to a selection or loop. Validation checks whether input meets the stated requirements, such as being within an allowed range or having an expected form. Keep the condition and the response to invalid input distinct in your trace, then check whether the program accepts or rejects the example supplied.
Work carefully with data and databases
Binary represents whole numbers using place values based on powers of two; hexadecimal provides a shorter way to write groups of binary digits. For a conversion, write the place values or group the bits before converting, then check the result by converting back. Image data uses pixels and colour information, while sound data records samples. Questions about file size depend on the information given, so identify the dimensions, colour depth or sampling details in the prompt and show how they combine rather than assuming a value that is not supplied.
A database organises records into tables with fields, and SQL statements select or change data according to their clauses. Read a query in order: identify the table and requested fields, then apply any condition and sorting instruction. Translation material concerns how source code is converted into instructions a computer can execute, including the roles of a compiler and an interpreter where these are listed. In each case, use the wording and values in the question. Do not add an assumed language rule or conversion convention that the prompt does not provide.
Use answers and mark schemes to find the next step
The component's material includes short recall checks as well as questions that need a trace, explanation or calculated result. Attempt a practice question before revealing its answer. For the recorded decomposition question, state the meaning in your own words, then compare it with the source answer: breaking a large, complex problem down into a series of smaller, more manageable sub-problems. The record assigns one mark. If your answer misses either the breaking down or the smaller sub-problems idea, revise that definition and try again without looking.
For longer exam-style questions, use the available mark scheme point by point. Match each point to a line or statement in your response and note any point you cannot support. In a trace-table question, compare the values in each row and identify the first incorrect transition. In an explanation, check whether you stated the relevant process and linked it to the question. If the final answer is wrong, keep correct earlier work and repair the first error instead of copying the complete answer. Then repeat the trace or explanation from the start to check that the correction holds.
Worked example. In computational thinking, what is meant by the term 'decomposition'?
- Attempt the definition before revealing the recorded answer.
- Compare your wording with the key idea: one large problem is divided into smaller sub-problems.
- The practice record assigns this question one mark.
Answer: Breaking a large, complex problem down into a series of smaller, more manageable sub-problems