The community swimming pool uses a program to calculate the cost of a group booking. The main program receives swimmers = 18 and pricePerSwimmer = 4.50. A t...

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

Question 1 Report

The community swimming pool uses a program to calculate the cost of a group booking. The main program receives swimmers = 18 and pricePerSwimmer = 4.50. A trainee programmer writes the statement totalCost = swimmers * pricePerSwimmer. The value of totalCost is displayed as part of a message to the organiser. The programmer must use an arithmetic operator that works with numeric data, rather than joining text strings. The skeleton program will later include a subroutine that applies discounts to large groups.

(a) When the statement is run, state the value assigned to totalCost. [1]
(b) Explain why the * operator is used in this statement. [2]



The village cinema uses a ticket program for a Saturday matinee. A pupil modifies the code so that the number of free seat upgrades can be found. The customer has earned points = 147, and each upgrade costs 25 points. The program uses upgrades = points DIV 25. It must also calculate unused points with a second arithmetic statement. Both values are passed to a subroutine that creates the message printed on the ticket. The player-like user does not see the internal variables.

(a) When the program calculates upgrades, state its value. [1]
(b) Explain which arithmetic operation should be used to calculate the unused points. [2]

Answer Details

Swimming-pool calculation

  1. (a) \(18 \times 4.50=81.0\), so totalCost is 81 or 81.0. [1]
  2. (b) The * operator performs multiplication. [1] It multiplies the number of swimmers by the cost for one swimmer, giving the total charge. [1] It is not used to join text: both values here are numeric.

Cinema-points calculation

  1. (a) 147 DIV 25 is 5, since \(5 \times 25=125\) and six upgrades would require 150 points. [1]
  2. (b) Use MOD, or modulo, to calculate unused points. [1] It gives the remainder after complete groups of 25 have been removed: 147 MOD 25 = 22, so 22 points are unused. [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