At a skating rink, a ticket program checks whether a visitor qualifies for a child price. The visitor's age is entered as an integer in age. Child tickets a...

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

Question 1 Report

At a skating rink, a ticket program checks whether a visitor qualifies for a child price. The visitor's age is entered as an integer in age. Child tickets are available to players and visitors who are under 13 years old. The skeleton program includes this command:

IF age < 13 THEN
price = 4.50
ENDIF

The manager wants the displayed price to be correct before a receipt is printed.

(a) Explain what the < relational operation tests. [1]
(b) When age is 13, state whether the statement in the IF block is carried out. [1]
(c) When the age is 12, explain why the assignment to price is carried out. [1]



In the dispatch program of a bicycle repair service, a mechanic enters the number of completed repairs into repairs. A bonus message is displayed only when the mechanic has completed between 12 and 20 repairs inclusive. The programmer must use relational operations in one selection statement.

(a) When repairs is 12, explain the result of repairs >= 12. [1]
(b) When repairs is 21, explain the result of repairs <= 20. [1]
(c) When both limits must be tested, write a complete condition using AND. [2]

Answer Details

Skating-rink program

  1. < tests whether the value on its left is less than the value on its right. Here it tests whether age is less than 13. [1]
  2. At age 13, age < 13 is false, so the statement inside the IF block is not carried out. [1]
  3. At age 12, 12 < 13 is true. Therefore the condition is true and price = 4.50 is carried out. [1]

Bicycle-repair program

  1. repairs >= 12 is true when repairs is 12, because >= includes the boundary value. [1]
  2. repairs <= 20 is false when repairs is 21, because 21 is greater than 20. [1]
  3. Both ends of the inclusive range must be true, so use:
    repairs >= 12 AND repairs <= 20 [2]

Use AND for a value that must be within a range: it must be at least the lower limit and no more than the upper limit.

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