Question 1 Report
A hospital pharmacy program checks a patient age before displaying an advice message. Fig. 1 gives the decision structure. Ages from 0 to 11 use the child message, ages from 12 to 64 use the adult message, and ages of 65 or more use the senior message. An impossible age is rejected. The programmer must test suitable boundary data to confirm that every route gives a correct output.
(a) Identify the output for an input age of 11. [1]
(b) State the output for an input age of 12. [1]
(c) Write the output for an input age of 65. [1]
(d) Give one invalid test value. [1]
(e) Use the algorithm to identify the largest age that receives the adult message. [1]
(a) Age 11 is below 12, so the output is child. [1]
(b) Age 12 is not below 12 but is below 65, so the output is adult. [1]
(c) Age 65 is not below 65, so the output is senior. [1]
(d) A valid invalid test value is -1. [1] Any negative age should follow the error route.
(e) The largest age receiving the adult message is 64. [1] The adult range ends immediately before the 65 boundary.
Everything you need to excel in your exams