A theatre technician is writing a program to prepare lighting cues for a small touring production. For each cue, the operator enters a cue label, fade durat...

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

Question 1 Report

A theatre technician is writing a program to prepare lighting cues for a small touring production. For each cue, the operator enters a cue label, fade duration in seconds, a lantern channel number, a colour code and a safety-approved value. The program must calculate the total fade time, display the next cue, and prevent an operator from saving unsafe settings. The code will use arrays to store several cues and a subroutine to validate each channel number.

(a) State suitable data types for fadeDuration, cueLabel and safetyApproved. [3]
(b) Explain why a colour code such as R17 should not be stored as an integer. [2]
(c) Write pseudocode for a validation subroutine that accepts channel numbers from 1 to 48 inclusive and returns TRUE for a valid number. [5]
(d) Describe three test cases for this subroutine, including expected returned values. [3]
(e) Explain two benefits of using a subroutine rather than repeating the validation commands in the main program. [3]

Answer Details

(a) Suitable data types are:

  • fadeDuration: real/floating-point; [1]
  • cueLabel: string/text; [1]
  • safetyApproved: Boolean. [1]

(b) R17 contains a letter as well as digits, so it cannot be an integer. It is a code/identifier rather than a value used for calculation. [2]

(c) A suitable validation subroutine is:

SUBROUTINE validChannel(channel)
  IF channel >= 1 AND channel <= 48 THEN
    RETURN TRUE
  ELSE
    RETURN FALSE
  ENDIF
ENDSUBROUTINE

The parameter receives the channel number; both inclusive boundary tests must be true for a valid channel. [5]

(d) Three suitable test cases are:

Test inputExpected returnReason
1TRUELower boundary is valid
48TRUEUpper boundary is valid
49FALSEJust above the maximum

[3]

(e) A subroutine is written once and reused wherever the validation is needed. It reduces duplicated commands and maintenance effort, and any correction is made in one place. It can also be tested independently and keeps the main program easier to read. [3]

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