ProgrammingHardProduct-company MCQ pattern

What is printed?

What is printed?
print(int(0.999999999999999999999), round(0.4999999999999999), round(-0.4999999999999999), int(-0.9))
  1. A. 0 0 0 0
  2. B. 1 1 -1 0
  3. C. 1 0 -1 0
  4. D. 1 0 0 0

Correct answer: D. 1 0 0 0

The literal 0.999999999999999999999 is the double 1.0, so int gives 1. Values just under one half round to zero, and int truncates -0.9 toward zero.

More Python Programming questions

Exams that ask this topic