Skip to topic
    ← Back to course topics

    Problem solving and programming — OCR A-Level Computer Science

    Test yourself on Problem solving and programming with OCR A-Level practice questions.

    Start free

    7 days Premium · Then free forever · No card, no charge

    Problem solving and programming explained

    This topic focuses on the practical application of computational thinking to solve problems through programming.

    Read the full explanation

    It covers essential programming techniques, computational methods, and the use of algorithms to describe and solve problems, requiring learners to demonstrate proficiency in both procedural and object-oriented paradigms.

    What to demonstrate

    1. Correct use of programming constructs (sequence, iteration, branching)
    2. Effective use of recursion compared to iterative approaches
    3. Proper implementation of modularity using functions and procedures
    Show all 8 objectives
    1. Correct parameter passing (by value and by reference)
    2. Application of object-oriented techniques (classes, objects, methods, attributes, inheritance, encapsulation, polymorphism)
    3. Correct use of Big O notation to describe algorithm complexity
    4. Accurate implementation of standard algorithms (sorting and searching)
    5. Correct traversal of data structures (stacks, queues, trees, linked lists)

    Problem solving and programming exam tips

    Topic Overview

    Problem solving and programming is the core of computer science, covering how to break down complex problems into manageable steps and implement solutions using a high-level programming language. In OCR A-Level Computer Science, this topic focuses on computational thinking, algorithm design, and writing robust, efficient code. You'll learn to use abstraction, decomposition, and pattern recognition to tackle problems, then translate your designs into Python (or another language) using sequence, selection, iteration, and data structures like arrays and lists.

    This topic is vital because programming is how we turn ideas into working software. It underpins everything from mobile apps to artificial intelligence. In the exam, you'll be asked to write, trace, and debug code, as well as explain your design decisions. Mastering this area builds logical thinking and precision, which are essential for both the coursework (NEA) and the written papers. You'll also explore key algorithms like linear and binary search, and sorting methods such as bubble, insertion, and merge sort.

    Problem solving and programming connects to other topics like data structures (stacks, queues, trees), computational thinking (thinking ahead, caching), and even ethical issues around software reliability. By the end, you should be able to take a vague problem statement, produce a clear algorithm (using pseudocode or flowcharts), and implement it in code that is readable, tested, and maintainable.

    Key Concepts
    • →Decomposition: Breaking a complex problem into smaller, more manageable sub-problems, each of which can be solved independently.
    • →Abstraction: Removing unnecessary details to focus on the essential features of a problem or solution, e.g., using a function to hide implementation details.
    • →Algorithm design: Creating a step-by-step set of instructions to solve a problem, often expressed as pseudocode or a flowchart before coding.
    • →Programming constructs: Sequence (executing statements in order), selection (if/else statements), and iteration (for/while loops) – the building blocks of any program.
    • →Testing and debugging: Using test data (normal, boundary, erroneous) to check your code works correctly, and systematically finding and fixing errors (syntax, logic, runtime).
    Marking Points
    • Correct use of programming constructs (sequence, iteration, branching)
    • Effective use of recursion compared to iterative approaches
    • Proper implementation of modularity using functions and procedures
    • Correct parameter passing (by value and by reference)
    • Application of object-oriented techniques (classes, objects, methods, attributes, inheritance, encapsulation, polymorphism)
    • Correct use of Big O notation to describe algorithm complexity
    • Accurate implementation of standard algorithms (sorting and searching)
    • Correct traversal of data structures (stacks, queues, trees, linked lists)
    Examiner Tips
    • 💡Be prepared to write or trace algorithms in pseudocode, ensuring the logic is clear and follows the provided syntax guide
    • 💡Practice identifying the most efficient algorithm for a given data set based on time and space complexity
    • 💡Ensure you can clearly explain the benefits and trade-offs of concurrent processing
    • 💡Familiarize yourself with the specific pseudocode syntax provided in the specification to avoid syntax errors in the exam
    • 💡When asked to design an algorithm, ensure you include all necessary steps and handle edge cases
    • 💡Always annotate your code or pseudocode with comments explaining the purpose of key sections. This shows the examiner you understand the logic and can help you gain marks even if there are minor syntax errors.
    • 💡When writing algorithms, use meaningful variable names (e.g., 'total' not 't') and follow the OCR pseudocode conventions exactly – especially for loops (e.g., FOR i ← 1 TO 10) and conditionals (e.g., IF … THEN … ELSE … ENDIF).
    • 💡For testing questions, always include a test plan with normal, boundary, and erroneous data. Explain what each test is checking and what the expected outcome should be. This demonstrates thoroughness and understanding of robustness.
    Common Mistakes
    • Confusing parameter passing by value and by reference
    • Incorrectly identifying the complexity of an algorithm using Big O notation
    • Failing to justify the choice of algorithm based on execution time and space
    • Misunderstanding the difference between abstraction and reality in computational models
    • Inappropriate use of global variables instead of local variables and parameter passing
    • Misconception: Pseudocode doesn't need to be precise – it's just rough notes. Correction: In OCR exams, pseudocode must follow a specific syntax (like the OCR pseudocode guide) and be detailed enough to be converted directly into code. Marks are lost for vague or ambiguous statements.
    • Misconception: If the code runs without errors, it's correct. Correction: A program can run but produce wrong outputs due to logic errors. You must test with a range of inputs, including boundary values, to ensure correctness.
    • Misconception: Using global variables is fine for simplicity. Correction: Overusing global variables makes code hard to debug and maintain. OCR expects you to use local variables and pass parameters to functions, demonstrating good modular design.
    Frequently Asked Questions
    What is the difference between pseudocode and a flowchart?
    Pseudocode is a text-based way to describe an algorithm using structured English that resembles code but without strict syntax rules. A flowchart is a visual diagram using symbols (e.g., rectangles for processes, diamonds for decisions) to show the flow of control. In OCR exams, you may be asked to produce either, but pseudocode is more common for written answers because it's quicker and easier to mark. Both should be clear enough that someone could implement the algorithm in a real programming language.
    How do I choose between a for loop and a while loop?
    Use a for loop when you know exactly how many times you need to repeat something – for example, iterating through an array of known size. Use a while loop when the number of repetitions depends on a condition that might change during execution – for example, reading user input until they enter 'quit'. In OCR, you need to justify your choice: for loops are more readable for fixed counts, while loops are more flexible for indefinite iteration.
    What does 'robust' mean in programming?
    A robust program handles unexpected inputs or errors gracefully without crashing. This includes validating user input (e.g., checking that a number is within a valid range), using try-except blocks to catch runtime errors, and ensuring that the program doesn't enter infinite loops. In the exam, you might be asked to suggest improvements to make code more robust, such as adding input validation or error handling.
    How do I trace through an algorithm in an exam?
    Create a trace table with columns for each variable and any output. Step through the algorithm line by line, updating the table as variables change. Pay attention to loop conditions and selection statements – write down the condition evaluation (true/false) to avoid mistakes. Practice with past paper questions, as tracing is a common 6-8 mark question. Remember to use the exact variable names and values as they appear in the algorithm.
    What is the difference between a parameter and an argument?
    A parameter is a variable listed in the function definition – it acts as a placeholder for the value that will be passed in. An argument is the actual value you supply when calling the function. For example, in 'def add(x, y):' x and y are parameters; in 'add(5, 3)' 5 and 3 are arguments. OCR expects you to use these terms correctly in explanations.
    How can I improve my programming skills for the NEA?
    Start by breaking your project into small, testable features (decomposition). Write pseudocode or a flowchart for each feature before coding. Use version control (like GitHub) to track changes. Test each feature thoroughly with normal, boundary, and erroneous data. Also, read the OCR Programming Project guide and look at exemplar work to understand the expected level of documentation and testing. Practice writing clean, well-commented code with meaningful variable names.