ProgrammingVery hardProduct-company MCQ pattern

What is printed?

What is printed?
print(0.1 * 0.1, 0.1 * 0.1 == 0.01, round(0.1 * 0.1, 2) == 0.01, 10 * 0.1 * 0.1 * 10 == 1)
  1. A. 0.01 False True True
  2. B. 0.010000000000000002 True True True
  3. C. 0.010000000000000002 False True True
  4. D. 0.010000000000000002 False False True

Correct answer: C. 0.010000000000000002 False True True

The product of 0.1 and 0.1 misses 0.01 by one unit in the last place, but rounding to two places fixes it. Multiplying by 10 at each end here happens to land exactly on 1.

More Python Programming questions

Exams that ask this topic