ProgrammingVery hardProduct-company MCQ pattern

What is printed?

What is printed?
print(1.0 == 1, 1.5 // 0.5, 1.5 % 0.4, 2.0 ** -1074 > 0, 2.0 ** -1075 == 0)
  1. A. True 3.0 0.1 True True
  2. B. True 3.0 0.29999999999999993 False True
  3. C. True 3.0 0.29999999999999993 True True
  4. D. False 3.0 0.29999999999999993 True True

Correct answer: C. True 3.0 0.29999999999999993 True True

1.5 // 0.5 is exactly 3.0. 1.5 % 0.4 comes out just under 0.3 because 0.4 is stored a bit above its decimal value. 2 to the power -1074 is the smallest subnormal, while -1075 is a tie that rounds to zero.

More Python Programming questions

Exams that ask this topic