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 correc...

Assessment: Computer Science 9210 | Paper 1 Mock 01 | Programming (on-screen) Subject: Computer Science - 9210

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]

Answer Details

(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]

Download The App On Google Playstore

Everything you need to excel in your exams

Green Bridge CBT Mobile App
Personalized AI Learning Chat Assistant
200,000+ Exam Questions Across IGCSE, JAMB, WAEC & NECO
Over 3,900 Lesson Notes
Offline Support - Learn Anytime, Anywhere
Green Bridge Timetable
Literature Summaries & Potential Questions
Track Your Performance & Progress
In-depth Explanations for Comprehensive Learning