The music festival app displays a countdown until the next performance. Fig. 1 shows the planned calls made by the main program. The function minutesLeft(st...

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

Question 1 Report

The music festival app displays a countdown until the next performance. Fig. 1 shows the planned calls made by the main program. The function minutesLeft(startTime, currentTime) calculates a number. The procedure showCountdown(minutes) uses that number to display a message. A developer has accidentally written showCountdown as a function and has included an unused return statement. The app must update each minute without repeating calculation commands in several screens.

main codecurrent timeminutesLeft(start, now)returns minutesshowCountdown(minutes)© EAGLE BEACON GLOBAL

(a) Explain why showCountdown should be a procedure. [2]
(b) When minutesLeft returns 12, state the argument passed to showCountdown. [1]
(c) Explain why the unused return statement should be removed. [1]
(d) When another screen needs the countdown, state which subroutine can be called again. [1]

Answer Details

(a) showCountdown should be a procedure because its purpose is to display an output message. It does not need to return a value to the main program. [2]

(b) If minutesLeft returns 12, the argument passed to showCountdown is 12. [1]

(c) The return statement should be removed because it is unnecessary and could mislead a programmer into thinking that showCountdown has the purpose of producing a returned result. [1]

(d) The program can call minutesLeft again to calculate a new countdown value and/or showCountdown again to display a countdown, depending on what the other screen needs. [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