A laboratory technician uses an automated digital scale to record the precise mass of chemical reagents in grams, where measurements typically contain decimal parts (e.g. 1.425 g).
Which data type is the most appropriate to store these measurements, and why?
Real, because mass measurements are continuous quantities that require the representation of fractional (decimal) parts.
Integer, because digital scales have finite precision, meaning the readings are stored as discrete whole numbers.
String, because text characters are needed to preserve the decimal point and maintain exact formatting.
Boolean, because the system only needs to record whether a reagent is present or absent on the scale.
Practise OCR GCSE Computer Science Programming fundamentals with exam-style questions for GCSE Computer Science. 100 questions, matched to the OCR GCSE Computer Science (J277) specification and written in Component 01 and Component 02 style. Every question includes a full worked solution and mark scheme, so you can see where marks are awarded rather than just whether you got the answer right.