Question 1 Report
In the planetarium quiz, a player earns a score based on the number of correct answers. The function awardStars(correct) should return 3 stars for 10 correct, 2 stars for 7 to 9 correct, 1 star for 4 to 6 correct, and 0 otherwise. The main program adds the returned stars to a displayed total. The programmer wants to test boundary values before the new quiz is released to visiting schools.
(a) Explain why 6, 7, 9 and 10 are useful test data for this function. [2]
(b) When awardStars(6) is called, state the value returned. [1]
(c) Explain why a test using 11 correct answers is also needed. [1]
(a) The values 6, 7, 9 and 10 lie at the limits of the score ranges. They test transitions between selection branches and can reveal an incorrect comparison operator or range boundary. [2]
(b) awardStars(6) returns 1, because 6 is within the range from 4 to 6 inclusive. [1]
(c) A test with 11 correct answers checks invalid or extreme input above the maximum possible score. [1]
Everything you need to excel in your exams