A museum is creating a touchscreen quiz about local fossils. The skeleton program stores a player's score in score. When the player chooses the correct answ...

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

Question 1 Report

A museum is creating a touchscreen quiz about local fossils. The skeleton program stores a player's score in score. When the player chooses the correct answer, the program must add one point before the next question is displayed.

(a) Explain why score should be stored as an integer rather than a string. [1]
(b) When the player gives a correct answer, write one program statement that updates score. [1]
(c) Explain why the score variable should be set to zero at the start of a new game. [1]



The table below shows test data entered into a school canteen ordering program. The program accepts an item code only when it has exactly three characters and starts with a letter.

TestItem code enteredExpected result
1A12accepted
2123rejected
3AB12rejected
4Z99accepted

(a) Explain why test 2 should be rejected. [1]
(b) When the programmer tests the boundary of the length rule, state one new item code that should be used. [1]
(c) Explain why both normal and erroneous test data are needed before the ordering program is used. [1]

Answer Details

Quiz program

(a) score should be an integer because points must be added using arithmetic. [1]

(b) A suitable increment statement is score = score + 1. [1]

(c) Setting the score to zero starts a new game fairly and prevents a new player receiving points from a previous game. [1]

Canteen ordering program

(a) 123 is rejected because its first character is a number, not a letter. [1]

(b) A suitable new boundary-length test is AB, which has two characters. ABCD, with four characters, is also acceptable. [1]

(c) Normal data checks that valid entries are accepted in ordinary use. Erroneous data checks that invalid entries are rejected or handled safely. Both are needed. [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