Practice question · Select all that apply
Select every statement that is TRUE.
Hints
- Two options restate misconceptions the lesson explicitly warns against.
- One concerns what assignment means; the other concerns exact equality of floats.
Show the answer
- A. Two floats should be compared by checking their difference is smaller than a small tolerance
- C. Multiplication binds more tightly than addition
- D. The symbol + can mean addition or text-joining depending on the operand types
Why
Assignment is a command, not an equality claim, and floats are approximate, so options 1 and 3 are false. The type-dependence of +, the precedence of *, and tolerance-based comparison are all exactly as taught.
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…
- Match each data type to its defining property.
- Order the evaluation steps of the expression 2 + 3 * (8 - 6) / 2.
- 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.