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}')- A. 0.1 0.3 0.3 0.5
- B. 0.1 0.2 0.3 0.5
- C. 0.1 0.2 0.4 0.5
- 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
- What is printed? python print(5 // 2 2, 5 >> 2, 5 / 2 2)
- What is printed? python print(1 + 2 3 2 // 4 % 5, (1 + 2) 3 2 // 4 % 5)
- What is printed? python print(1 == 1.0 and '1' != 1, [1, 2] == [1.0, 2.0], (1, 'a') == (1.0, 'a'))
- What is printed? python print(set([1, 2]) == {1.0, 2.0}, {1: 'x'}.get(1.0), {'1': 2}.get(1))
- What is printed? python print(2 63 - 1 == 9223372036854775807, (2 63) % 10, -2 63 // 10)
- What is printed? python print(str(10 15 / 10), str(10 16 / 10), 10 16 // 10)