ProgrammingVery hardProduct-company MCQ pattern

What is printed?

What is printed?
print(f'{12345678:,}', f'{0.5:.0%}', f'{2.5:.0f}', f'{3.5:.0f}', f'{-0.4:.0f}')
  1. A. 12,345,678 50% 3 4 -0
  2. B. 12345678 50% 2 4 -0
  3. C. 12,345,678 50% 2 4 -1
  4. D. 12,345,678 50% 2 4 -0

Correct answer: D. 12,345,678 50% 2 4 -0

Format rounding is round-half-to-even, so 2.5 becomes 2 and 3.5 becomes 4. -0.4 rounds to zero but keeps its sign, so the output is -0.

More Python Programming questions

Exams that ask this topic