Question 1 Report
A chemistry department stores pH results from a river survey in a file. For each sample, a student enters a location code and a pH value. The program should display a message if the pH value is not between 0 and 14, then allow the student to enter the value again. A later program reads the file to draw a graph of pH against location.
(a) Explain why the range test is appropriate for the pH input. [2]
(b) State one output device that could display the message. [1]
Table 1 shows part of a comma-separated file used by a parcel depot. The dispatch program reads each line, calculates the total mass for a delivery route and then displays the route number and total. Staff must be able to add new parcel records without deleting records already collected during the shift.
| ParcelID | Route | Mass (kg) |
|---|---|---|
| P1048 | N3 | 2.6 |
| P1049 | N3 | 1.4 |
| P1050 | W1 | 3.2 |
(a) When processing the first two records, calculate the displayed total mass for route N3. [1]
(b) State the file operation used to add a new record while retaining the existing file contents. [1]
(c) Explain why a comma is useful as a separator in this file. [2]
River pH results
Parcel-depot file
Everything you need to excel in your exams