Practice question · Match the pairs
Match each data type to its defining property.
- Integer
- Float
- Boolean
- String
- Text, which + joins rather than adds
- One of exactly two values, true or false
- Numbers with a fractional part, stored approximately
- Whole numbers, stored exactly
Hints
- Only one of these types is described as approximate.
- One type has exactly two possible values in the whole language.
Show the answer
- Integer → Whole numbers, stored exactly
- Float → Numbers with a fractional part, stored approximately
- Boolean → One of exactly two values, true or false
- String → Text, which + joins rather than adds
Why
Exactness is what separates integers from floats, and it is why counting is safe in integers but accumulating fractions is not. Booleans carry the verdicts that conditions produce, and strings are the type on which + changes meaning.
Practise Variables, Types, and Expressions
The app has 4 more questions on this lesson, and keeps your place in the course. Mathematics I is free to start.
More questions on Variables, Types, and Expressions
- In most languages 0.1 + 0.2 == 0.3 evaluates to false. Why do experienced programmers compare floats with a…
- Order the evaluation steps of the expression 2 + 3 * (8 - 6) / 2.
- Select every statement that is TRUE.
- Because a float stores only finitely many digits, two computations that are mathematically equal can produce…
- In mathematics x = x + 1 is a contradiction with no solution. In most programming languages it is a routine…
- The symbol + adds numbers but joins text. Sort each expression by what + actually does.