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 code | Crabs counted | Litter found |
|---|---|---|
| TP07 | 18 | TRUE |
| RK12 | 0 | FALSE |
| LM03 | 126 | TRUE |
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
(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]
Everything you need to excel in your exams