AS & A Level Computer Science (9618)

A Level · Topic 20

Develop and evaluate a practical solution

Use programming paradigms, file handling, exceptions, and systematic testing.

Lessons distinguish AS topics 1–12 from A Level topics 13–20. Examples include Cambridge pseudocode and Python.

Match the paradigm to the task

Procedural programming organizes steps into subroutines. Object-oriented programming combines state and behavior in objects. A declarative approach describes the desired result or relationships rather than every execution step. Compare the model with the problem rather than treating syntax as the whole paradigm.

For an object model, define constructors, responsibilities, and valid state transitions. For inheritance, ask whether a subtype can meet the contract of the base type. Reusing fields alone does not justify the relationship.

Plan failure as well as success

File operations can fail because a file is missing, a record is malformed, or a resource is unavailable. Catch exceptions where the program can take a meaningful action. Silently discarding an error may produce a plausible but incorrect result.

The Python example computes a mean and deliberately rejects an empty sequence. It demonstrates a practical-language solution, not a program for the pseudocode editor. Extend its tests with one value, repeated values, and negative values before using it in a larger program.

def mean(values):
    if not values:
        raise ValueError("At least one value is required")
    return sum(values) / len(values)

print(mean([2, 4, 6]))

Check yourself

Why is returning 0 for every file-reading error a weak recovery strategy?Show answer

It can make failure look like a legitimate result. Report the error or use an explicitly defined recovery path.

References used to build these lessons

We used these official documents as references when building this course's lessons. They are the sources for the syllabus structure and course requirements.

Cambridge International · 9618 · Exams 2027–2029