Programming techniques — OCR A-Level Computer Science
Test yourself on Programming techniques with OCR A-Level practice questions.
7 days Premium · Then free forever · No card, no charge
Programming techniques explained
This topic covers the fundamental programming techniques required to develop software solutions, including control structures, modularity, and object-oriented programming.
Read the full explanation
It emphasizes the use of recursion, variable scope, and integrated development environments (IDEs) to create efficient and maintainable code.
What to demonstrate
- Correct use of programming constructs: sequence, iteration, and branching.
- Understanding and implementation of recursion compared to iterative approaches.
- Correct application of global and local variable scope.
Show all 6 objectives
- Effective use of modularity through functions and procedures, including parameter passing by value and by reference.
- Demonstration of object-oriented programming techniques.
- Effective use of an IDE for program development and debugging.
Programming techniques exam tips
Topic Overview
Programming techniques form the backbone of computer science, encompassing the methods and practices used to design, write, and maintain code. In OCR A-Level Computer Science, this topic covers structured programming, object-oriented programming (OOP), and functional programming paradigms, alongside essential constructs like sequence, selection, and iteration. You'll learn how to decompose problems, use subroutines effectively, and manage data through arrays, lists, and dictionaries. Mastering these techniques is crucial for developing efficient, readable, and maintainable software—a skill valued in both exams and real-world development.
This topic builds on GCSE programming fundamentals and prepares you for more advanced concepts like recursion, abstraction, and algorithm complexity. In the OCR specification, programming techniques are assessed through both written exams and the non-exam assessment (NEA), where you'll apply these skills to a substantial programming project. Understanding how to choose the right paradigm for a problem, implement robust error handling, and write modular code will directly impact your exam performance and practical ability. Beyond the classroom, these techniques are used in industry to build everything from mobile apps to AI systems.
Programming techniques are not just about syntax; they're about thinking like a computer scientist. You'll develop problem-solving strategies such as top-down design, stepwise refinement, and test-driven development. The OCR syllabus emphasises the importance of writing clear, well-documented code that is easy to debug and adapt. By the end of this topic, you should be able to compare paradigms, justify your choice of data structures, and produce programs that meet specified requirements efficiently. This knowledge is assessed through questions on code snippets, algorithm design, and scenario-based problems.
Key Concepts
- →Structured programming: Use of sequence, selection (if/else), and iteration (for/while loops) with single entry and exit points to avoid spaghetti code.
- →Subroutines (procedures and functions): Breaking code into reusable blocks; understanding scope (local vs global variables) and parameter passing (by value vs by reference).
- →Object-oriented programming (OOP): Encapsulation, inheritance, polymorphism, and abstraction—designing classes with attributes and methods to model real-world entities.
- →Data structures: Arrays (1D and 2D), lists, tuples, dictionaries, and records; knowing when to use each for efficient data manipulation.
- →Error handling and testing: Using try-except blocks, validation, and debugging techniques to produce robust code; understanding syntax, logic, and runtime errors.
Marking Points
- Correct use of programming constructs: sequence, iteration, and branching.
- Understanding and implementation of recursion compared to iterative approaches.
- Correct application of global and local variable scope.
- Effective use of modularity through functions and procedures, including parameter passing by value and by reference.
- Demonstration of object-oriented programming techniques.
- Effective use of an IDE for program development and debugging.
Examiner Tips
- 💡Be prepared to trace code snippets involving recursion and identify the base case.
- 💡Practice identifying whether a variable should be global or local in a given context.
- 💡Ensure you can distinguish between passing by value and passing by reference in pseudocode.
- 💡Familiarize yourself with the provided pseudocode syntax to avoid syntax errors in the exam.
- 💡When asked to write code, focus on logical correctness and clarity rather than memorizing specific language syntax.
- 💡Always trace through your code with a simple test case before writing the final answer. Examiners award marks for correct logic, not just syntax. Use a trace table to show variable changes.
- 💡When asked to compare paradigms (e.g., procedural vs OOP), use specific examples from the scenario. Don't just list features—explain how they solve the problem differently.
- 💡In the NEA, document your programming techniques clearly. Use comments, meaningful variable names, and modular design. Examiners look for evidence of structured programming and appropriate use of data structures.
Common Mistakes
- Confusing parameter passing by value with passing by reference.
- Incorrectly managing variable scope, leading to unintended side effects.
- Failing to provide a base case in recursive functions, leading to stack overflow.
- Inappropriate use of global variables when local variables would be more suitable.
- Poor annotation of code, making maintenance difficult.
- Misconception: 'A function and a procedure are the same thing.' Correction: A function returns a value, while a procedure does not. In Python, all subroutines are functions, but they can return None. In OCR, you must distinguish between them in pseudocode.
- Misconception: 'Global variables are always bad.' Correction: While overuse of globals can lead to code that is hard to debug, they are sometimes necessary (e.g., constants). The key is to minimise their use and prefer local variables with parameter passing.
- Misconception: 'Inheritance always improves code.' Correction: Inheritance can create tight coupling and complex hierarchies. Composition (using objects within other objects) is often a better design choice. OCR expects you to evaluate trade-offs.