Table 1 shows test data collected by a coastal research station. Its program is being written in a code editor to store observations made at different tide ...

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

Question 1 Report

Table 1 shows test data collected by a coastal research station. Its program is being written in a code editor to store observations made at different tide pools. For each observation, the user enters a pool code, the number of crabs counted and whether litter was found. The program will later display a total for each pool. The programmer must choose suitable data types before writing the algorithm.

Pool codeCrabs countedLitter found
TP0718TRUE
RK120FALSE
LM03126TRUE

Table 1: Test data for the observation program

(a) Identify the most suitable data type for poolCode. [1]
(b) Identify the most suitable data type for crabsCounted. [1]
(c) Identify the most suitable data type for litterFound. [1]
(d) Write one assignment statement that stores the value 18 in the variable crabsCounted. [2]
(e) Complete the pseudocode so that the program accepts the number as input and displays a correct message when 100 or more crabs are counted. [5]
INPUT crabsCounted
IF crabsCounted ______ 100 THEN
  DISPLAY ______
ELSE
  DISPLAY "Count below 100"
ENDIF

Answer Details

(a) poolCode should be a string or text value. Codes such as TP07 contain letters and must retain leading zeroes where present. [1]

(b) crabsCounted should be an integer, because it is a whole-number count. [1]

(c) litterFound should be a Boolean, because it has only the two states TRUE and FALSE. [1]

(d) A correct assignment statement is crabsCounted = 18. [2] The variable name identifies where the value is stored, and = is the assignment operator in this pseudocode style.

(e) The condition must include 100, so use greater than or equal to:

INPUT crabsCounted
IF crabsCounted >= 100 THEN
  DISPLAY "Count is 100 or more"
ELSE
  DISPLAY "Count below 100"
ENDIF

>= correctly accepts 100 and every larger count [1][1]. The display command and a suitable message for 100 or more are required [1][1], while the ELSE route gives "Count below 100" only for inputs below 100. [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