ProgrammingVery hardProduct-company MCQ pattern

What is printed?

What is printed?
print(max(-0.0, 0), min(0, -0.0), -0.0 + 0, 0 - 0.0)
  1. A. -0.0 1 0.0 0.0
  2. B. -0.0 0 0.0 0.0
  3. C. -0.0 0 1.0 0.0
  4. D. -0.0 0 0.0 2.0

Correct answer: B. -0.0 0 0.0 0.0

max and min return the first item when values compare equal, so max(-0.0, 0) keeps -0.0 and min(0, -0.0) keeps 0. Adding an int 0 to -0.0 gives +0.0, and 0 - 0.0 is +0.0.

More Python Programming questions

Exams that ask this topic