ProgrammingVery hardProduct-company MCQ pattern

What is printed?

What is printed?
print(round(3.14159, 3), round(2.5e-7, 7), round(123.456, -1), round(-0.0001, 2))
  1. A. 3.142 2e-07 120.0 -0.0
  2. B. 3.142 3e-07 120.0 -0.0
  3. C. 3.142 2e-07 130.0 -0.0
  4. D. 3.141 2e-07 120.0 -0.0

Correct answer: A. 3.142 2e-07 120.0 -0.0

2.5e-7 is stored a little below the half-way mark, so it rounds down to 2e-07. Rounding a small negative float to two places keeps the sign, so the result is -0.0.

More Python Programming questions

Exams that ask this topic