Component 2: Algorithms and Programming A Level Computer Science Worksheets, Questions and Revision
9 original Component 2: Algorithms and Programming worksheet packs - 118 printable pages with full mark schemes. Computational thinking, algorithms, programming paradigms and data structures. View any pack in the browser or open the print-ready PDF.
- packs
- 9
- question pages
- 73
- printable pages
- 118
- Full PackRevise this topic: Elements of Computational Thinking
More formats: Elements of Computational Thinking
- Full PackRevise this topic: Problem Solving and Programming
More formats: Problem Solving and Programming
- Full PackRevise this topic: Algorithms: Complexity, Searching and Sorting
More formats: Algorithms: Complexity, Searching and Sorting
- Full PackRevise this topic: Programming Paradigms and OOP
More formats: Programming Paradigms and OOP
- Full PackRevise this topic: Data Structures and Their Operations
More formats: Data Structures and Their Operations
- Full PackRevise this topic: Advanced Algorithms: Searching, Sorting and Path-Finding
More formats: Advanced Algorithms: Searching, Sorting and Path-Finding
- Full PackRevise this topic: Data Representation and Theory of Computation
More formats: Data Representation and Theory of Computation
Free for personal and classroom use - see copyright & terms.
A team is designing a new online cinema booking system. Use decomposition to identify three separate sub-problems the team would need to solve, and state one detail that could be abstracted away for one of your sub-problems at an early design stage.
- Break the overall system down into separate, manageable parts: (1) searching for and displaying available film showings, (2) selecting and reserving specific seats, (3) taking payment and issuing a booking confirmation.
- Check that each sub-problem can sensibly be designed and solved on its own, without needing to know the fine detail of the others yet.
- Choose one sub-problem, e.g. taking payment, and identify a detail that does not need to be decided yet, e.g. exactly which payment provider will process the card details.
- Final answer: sub-problems are (1) showing search/display, (2) seat selection, (3) payment and confirmation; for payment, the exact payment provider used can be abstracted away at this early stage.
Working on component 2: algorithms and programming
Algorithms and programming practice begins before a program runs. This component subset lets you move from breaking a problem into manageable parts to tracing how a particular procedure changes its variables. Elements of computational thinking is the A Level Computer Science topic covering the general problem-solving techniques used before writing any code, including abstraction, decomposition, pattern recognition and algorithmic thinking, alongside tools such as truth tables, Boolean simplification and backtracking. It opens the Component 2 Algorithms and Programming paper. Practise decomposition by breaking a described system into 3 or more clearly separate sub-problems before thinking about any code. Practise abstraction by identifying which details of a problem can be safely ignored at a given stage of design, and which are essential.
Recognise pattern recognition techniques, such as spotting repeated values (which run-length encoding exploits) or spotting repeated sub-problems in a recursive algorithm. Complete truth tables for logical expressions, then use a Boolean law such as De Morgan's to show two expressions are logically equivalent.
Elements of Computational Thinking
Elements of Computational Thinking method: Apply memoisation (caching results as they are calculated) to avoid recalculating the same value, and trace how a cache array fills as an algorithm runs. Trace backtracking algorithms step by step, noting the point at which a dead end is reached and the algorithm returns to try an alternative choice.
Worked example. A team is designing a new online cinema booking system. Use decomposition to identify three separate sub-problems the team would need to solve, and state one detail that could be abstracted away for one of your sub-problems at an early design stage.
- Break the overall system down into separate, manageable parts: (1) searching for and displaying available film showings, (2) selecting and reserving specific seats, (3) taking payment and issuing a booking confirmation.
- Check that each sub-problem can sensibly be designed and solved on its own, without needing to know the fine detail of the others yet.
- Choose one sub-problem, e.g. taking payment, and identify a detail that does not need to be decided yet, e.g. exactly which payment provider will process the card details.
- Final answer: sub-problems are (1) showing search/display, (2) seat selection, (3) payment and confirmation; for payment, the exact payment provider used can be abstracted away at this early stage.
Answer: Final answer: sub-problems are (1) showing search/display, (2) seat selection, (3) payment and confirmation; for payment, the exact payment provider used can be abstracted away at this early stage.
Problem Solving and Programming
Problem Solving and Programming method: Choose the correct primitive data type (INTEGER, REAL, BOOLEAN, CHAR, STRING) for each piece of data before writing any pseudocode. Trace iterative code (FOR, WHILE, REPEAT...UNTIL) line by line in a trace table, updating every variable after each line or iteration.
Convert between equivalent selection structures, e.g. rewriting a CASE statement as nested IF...THEN...ELSE, and check each is closed correctly. Use string-handling functions (LEN, MID, LEFT, RIGHT, ASC, UCASE) to validate or manipulate string data such as codes and names.
Worked example. A programmer writes: PROCEDURE Triple(BYREF x : INTEGER) x <- x * 3 ENDPROCEDURE. num1 <- 4. Triple(num1). OUTPUT num1. State the value output for num1, and explain why.
- Note that x is declared BYREF, meaning the parameter is passed by reference, so x inside the procedure refers to the same memory location as num1.
- Trace the call: num1 starts at 4, so when Triple(num1) is called, x also starts at 4.
- Inside the procedure, x <- x * 3 sets x to 12; because x is the same variable as num1, num1 also becomes 12.
- Final answer: OUTPUT num1 produces 12, because passing by reference means changes made to the parameter inside the procedure directly change the original variable.
Answer: Final answer: OUTPUT num1 produces 12, because passing by reference means changes made to the parameter inside the procedure directly change the original variable.