ProgrammingVery hardProduct-company MCQ pattern

What is printed?

What is printed?
print(f'{0.1:.1f}', f'{0.25:.1f}', f'{0.35:.1f}', f'{0.45:.1f}')
  1. A. 0.1 0.3 0.3 0.5
  2. B. 0.1 0.2 0.3 0.5
  3. C. 0.1 0.2 0.4 0.5
  4. D. 0.1 0.2 0.3 0.4

Correct answer: B. 0.1 0.2 0.3 0.5

0.25 is an exact tie, so it goes to the even digit 0.2. 0.35 is stored just below its midpoint and gives 0.3, while 0.45 is stored just above and rounds up to 0.5.

More Python Programming questions

Exams that ask this topic