AQA A-Level Computer Science AS Paper 1, June 2025: Question 8
3 marks ยท Medium difficulty ยท Short Answer
Identify a subroutine in the Skeleton Program using exception handling and explain why exception handling is used within it.
Practise this questionQuestion
Question text
08.1 State the identifier of a subroutine in the Skeleton Program that uses
exception handling.
[1 mark]
08.2 Explain why exception handling is used in this subroutine.
[2 marks]
Mark scheme
Show the mark scheme
08 1 Mark is for AO2 (analyse) 1
CheckDistance;
R. if any additional code
R. if spelt incorrectly
I. case and spacing
08 2 2 marks for AO2 (analyse) 2
The string/character supplied may not be (convertible to) an integer;
Without exception handling the program would crash;
How to answer it
Exception Handling in the Skeleton Program
This question evaluates your ability to navigate, inspect, and analyse the Skeleton Program (Assessment Objective AO2). Specifically, it assesses:
- Identifying programming constructs such as structured exception handling (e.g. try...except / try...catch blocks).
- Understanding the operational purpose of defensive programming: preventing runtime crashes during data type conversion (casting) of user inputs.
Question 08.1
1 Mark • AO2 (Analyse)Identify the subroutine using exception handling
โ Correct Answer
CheckDistance
Case and spacing are ignored by examiners, but exact spelling is strictly required.
๐ง Exam Technique
- Use Ctrl+F: Quickly search the Skeleton Program file for language-specific keywords:
โข Python: try or except
โข C# / Java: try or catch
โข VB.NET: Try or Catch - Give only the identifier name. Do not include parentheses or parameters unless explicitly asked.
โ Common Errors & Mark Scheme Guidance
- Reject (R): Providing extra code alongside the subroutine identifier (e.g. writing Function CheckDistance() or CheckDistance = True ).
- Reject (R): Misspelling the name (e.g. CheckDistances or ChekDistance ).
- Ignore (I): Differences in case or surrounding whitespace (e.g. checkdistance is fully credited).
Question 08.2
2 Marks • AO2 (Analyse)Explain the purpose of exception handling in CheckDistance
โ Model Answer (Full 2 Marks)
To secure both marks, your response must cover the cause of the potential error and the consequence avoided:
- Mark 1 (Input/Type issue): The string or character entered by the user may not be valid or convertible to an integer.
- Mark 2 (System outcome): Without exception handling, this conversion would produce a runtime error and cause the program to crash / terminate unexpectedly.
๐ก Key Knowledge: Why Catch Errors?
In user-facing programs, input always enters as a string/text format:
- Converting "15" → integer 15 succeeds.
- Converting "fifteen" or "" → throws an exception (e.g. ValueError or FormatException ).
- Graceful Recovery: Exception handling intercepts this runtime error, allowing the program to display an error prompt and ask again rather than halting execution.
๐ง Exam Technique: "Explain Why" Pattern
For a 2-mark explanation question on error handling, always follow the two-part structure:
[Specific Trigger] What user action creates the fault? (e.g. "entering non-numeric data that cannot cast to an int")
+
[Program Consequence] What bad outcome does the handler avoid? (e.g. "prevents an unhandled exception causing a program crash").
โ Common Misconceptions & Lost Marks
- Vague answers: Simply writing "to stop errors" or "to validate data" scores 0 marks without explaining which error or how it crashes.
- Missing the conversion aspect: Forgetting to mention the data type mismatch (string cannot be converted to integer).
- Confusing validation with exception handling: Saying "it checks if the distance is between 1 and 10" misses the point. Exception handling specifically traps runtime conversion failures, not range boundaries.
โข 1 Mark: The string/character supplied may not be (convertible to) an integer.
โข 1 Mark: Without exception handling the program would crash / halt execution.
Topics
4.1 Fundamentals of programming ยท 4.1.1 Programming
Question and mark scheme from the AQA A-Level Computer Science examination, AS Paper 1, June 2025. QuestionVault is an independent revision resource; questions remain the copyright of the awarding body.