Skip to content

9618 · 12.3

Program Testing and Maintenance — practice questions

Practice and worked examples for 9618 Program Testing and Maintenance. Short previews only — attempt the full question in MarkScheme against the official scheme.

Worked example 1

A program includes a function CheckDiscount(Age) that returns TRUE if a person is eligible for a discount and FALSE otherwise. The discount is available for ages 18 to 25 inclusive. Complete a test plan with four distinct test cases for this function.

Show solution outline

Here is a sample test plan. Note the justification for each data choice.

Test CaseTest Data (Age)Type of DataExpected OutcomeActual OutcomeJustification
120NormalTRUEA typical valid age within the range.
---------------
218BoundaryTRUEThe lowest valid value in the range.
326BoundaryFALSEThe first invalid value just above the upper limit.
4'nineteen'AbnormalError message / FALSEData of the wrong type (string instead of integer).

Worked example 2

A procedure CalculateGrade(Score) is designed to work with integer scores from 0 to 100. Create a test plan with five test cases to check its robustness.

Show solution outline

The goal is to test the input validation and handling of edge cases.

Test CaseTest Data (Score)Type of DataExpected OutcomeActual OutcomeJustification
175NormalGrade 'A' (or similar valid output)A standard, valid score in the middle of the range.
---------------
20BoundaryGrade 'F' (or lowest valid grade)The lowest possible valid score.
3100BoundaryGrade 'A+' (or highest valid grade)The highest possible valid score.
4101BoundaryError message or rejectionThe first integer value just outside the valid upper boundary.
5-1BoundaryError message or rejectionThe first integer value just outside the valid lower boundary.