ProgrammingVery hardProduct-company MCQ pattern

What is printed?

What is printed?
print(0.1 + 0.7 == 0.8, 0.8 - 0.7, 0.3 / 0.1, int(0.3 / 0.1))
  1. A. True 0.1 3.0 3
  2. B. False 0.10000000000000009 2.9999999999999996 2
  3. C. False 0.1 2.9999999999999996 3
  4. D. False 0.10000000000000009 3.0 2

Correct answer: B. False 0.10000000000000009 2.9999999999999996 2

0.1 + 0.7 rounds to a value slightly above 0.8, and 0.8 - 0.7 exposes the error. 0.3 / 0.1 is just below 3, so int truncates it to 2.

More Python Programming questions

Exams that ask this topic