For each photograph uploaded to a wildlife survey website, the program creates a safe file name. The function makeFileName(siteCode, photoNumber) returns te...

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

Question 1 Report

For each photograph uploaded to a wildlife survey website, the program creates a safe file name. The function makeFileName(siteCode, photoNumber) returns text in the form siteCode_photoNumber.jpg. For example, site code RIV and photograph number 27 should produce RIV_27.jpg. A separate procedure later saves the image using this returned text. The survey team needs the same naming rule in a desktop program used at remote field stations.

(a) Explain why makeFileName should return a string rather than display the file name. [2]
(b) When called with makeFileName("RIV", 27), state the returned string. [1]
(c) Explain one advantage of using this function in both versions of the survey program. [1]

Answer Details

(a) makeFileName should return a string because the file name must be passed to the saving procedure or stored for later use. Displaying it would only show output and would not provide a usable value to other program statements. [2]

(b) The returned string is RIV_27.jpg. [1]

(c) Using the same function makes the file-naming rule consistent in both programs. A later change to the rule can be made once in the function rather than separately in each use. [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