The attendance program at an outdoor climbing club checks a participant's signed consent form. The variable consent stores either "YES" or "NO". Before the ...

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

Question 1 Report

The attendance program at an outdoor climbing club checks a participant's signed consent form. The variable consent stores either "YES" or "NO". Before the participant is added to the climbing list, the program needs to reject every value except "YES".

IF consent = "NO" THEN
DISPLAY "Consent required"
ENDIF

A coordinator notices that an accidental entry of "MAYBE" receives no message.

(a) Explain why the existing equality test does not deal with "MAYBE". [1]
(b) When the value is anything other than "YES", write a condition that displays the message. [1]
(c) When consent is "YES", state the Boolean result of your condition. [1]
(d) Explain why the new condition is more reliable for this program. [1]



A sports hall booking program checks that a requested court number is valid before it stores a new booking. Courts are numbered 1 to 4. The number typed by a player is stored in court. The programmer proposes this condition:

IF court >= 1 AND court <= 4 THEN
CALL saveBooking()
ENDIF

The subroutine must not be called for court 0 or court 5.

(a) Explain the purpose of the relational operation court >= 1. [1]
(b) When court is 4, state whether saveBooking() is called. [1]
(c) When court is 5, explain why the full condition is false. [1]

Answer Details

Consent validation

  1. "MAYBE" is not equal to "NO", so consent = "NO" is false and no message is displayed. [1]
  2. To reject every value except the permitted value, use:
    consent <> "YES" [1]
  3. When consent is "YES", this condition is false. [1]
  4. The new condition is more reliable because it rejects all invalid entries, not just the particular entry "NO". [1]

Court booking

  1. court >= 1 checks that the court number is at least 1, so it is not below the valid range. [1]
  2. When court is 4, both tests are true, so saveBooking() is called. [1]
  3. When court is 5, court <= 4 is false. Since both conditions must be true with AND, the full condition is false. [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