Table 1 shows data exported from a wildlife rescue centre. Volunteers use a program to record animals that arrive during one day. Each row will become a rec...

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

Question 1 Report

Table 1 shows data exported from a wildlife rescue centre. Volunteers use a program to record animals that arrive during one day. Each row will become a record in an array called admissions. The program uses the data to display a daily total by species and to find animals ready for release.

Array positionAdmission codeSpeciesMass / gReady for releaseDays in care
0R-2401Hedgehog680false3
1R-2402Swift41.5true12
2R-2403Hedgehog725true9
3R-2404Bat9.8false1
4R-2405Swift39.0true7

The code editor has the following field names: code, species, mass, ready and days. The program must only use correct array positions. At the end of the day, the data file is encrypted for transfer to a regional database.

(a) Identify the array position of the bat record. [1]
(b) Write the most suitable data type for each of code, mass, ready and days. [4]
(c) Give two reasons why an array of records is more suitable than five separate arrays for this program. [3]
(d) Complete the pseudocode that counts animals ready for release.
releaseTotal = 0
FOR i = 0 TO 4
  IF admissions[i].ready = _____ THEN
    releaseTotal = releaseTotal + _____
  ENDIF
NEXT i [3]
(e) Use Table 1 to state the value displayed in releaseTotal. [2]
(f) Complete a condition that identifies a hedgehog ready for release.
IF admissions[i].species = "Hedgehog" _____ admissions[i].ready = true THEN [2]
(g) State two test data values for days, one valid boundary value and one invalid value, assuming the permitted range is 0 to 365. [4]

Answer Details

(a) The bat record is at array position 3. [1]

(b) Suitable field types are: code, String [1]; mass, Real or floating-point [1]; ready, Boolean [1]; and days, Integer [1]. [4]

(c) An array of records keeps all fields for one animal together [1], so one array element represents one admission [1]. It reduces the chance that matching positions in separate arrays become unsynchronised [1]. It also makes searching, adding, and saving a complete admission easier. [3]

(d) The loop checks each of the five records [1]. A ready animal adds one to the counter:

releaseTotal = 0
FOR i = 0 TO 4
    IF admissions[i].ready = true THEN
        releaseTotal = releaseTotal + 1
    ENDIF
NEXT i

true gains [1] and adding 1 gains [1]. [3]

(e) Three records are ready for release: the swift at position 1, hedgehog at position 2, and swift at position 4. Therefore releaseTotal is 3. [2]

(f) Both facts must be true, so use:

IF admissions[i].species = "Hedgehog" AND admissions[i].ready = true THEN

[2]

(g) A valid boundary test value is 0 or 365 [1], identified as valid boundary data [1]. An invalid value could be -1 or 366 [1], identified as outside the permitted range [1]. [4]

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