An industrial IoT sensor measures the electrical current flowing through a smart-grid node every millisecond. The measurements can be positive or negative and are recorded to three decimal places (for example, -14.802 A or 5.150 A).
Select the option that identifies the most appropriate primitive data type to store an individual current reading and provides the correct justification.
IntegerIntegerInteger, because the current is sampled at discrete millisecond intervals, meaning each measurement represents a distinct, countable value.
StringStringString, because it is the only primitive type that can preserve both the negative sign and the decimal point character without numerical drift.
RealRealReal (or Float), because the measurements are continuous physical quantities with fractional parts, requiring a data type that supports floating-point representation.
BooleanBooleanBoolean, because the sensor only needs to record whether the current is flowing in the positive direction (true) or negative direction (false).
26 exam-style questions on OCR GCSE Computer Science Data types. Each one has a worked solution and a mark scheme showing where the marks go.