A community bus uses a program to display whether a passenger may use a discounted fare. The code editor receives the passenger's age as an integer. Table 1...

Assessment: Computer Science 4CP0 | Paper 2 Mock 01 | Written Paper 2 Subject: Computer Science - 4CP0

Question 1 Report

A community bus uses a program to display whether a passenger may use a discounted fare. The code editor receives the passenger's age as an integer. Table 1 shows test data entered during a test of the program. The word eligible is a Boolean variable. The program should set eligible to TRUE when the age is less than 16 or greater than or equal to 65. It must then display the correct message.

Test numberage inputExpected display
112Discount available
216Standard fare
365Discount available

Table 1: test data for the bus-fare program

(a) Identify the data type of age. [2]
(b) Complete this condition: IF age < 16 OR age ______ 65 THEN [2]
(c) Use Table 1 to write the value of eligible for test number 2 and the message displayed for test number 3. [2]

Answer Details

(a) age is an integer [1]. It stores whole-number data, with no decimal values [1]. [2]

(b) The completed condition is:

IF age < 16 OR age >= 65 THEN

>= includes age 65 itself, which is important because passengers aged 65 qualify. [2]

(c) For age 16, neither age < 16 nor age >= 65 is true, so eligible is FALSE [1]. For age 65, the second test is true, so the display is Discount available [1]. [2]

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