ProgrammingVery hardProduct-company MCQ pattern
What is printed?
What is printed?
print(round(0.1 * 0.1, 3) == 0.01, round(2.345, 2), round(2.355, 2))
- A. True 2.34 2.36
- B. False 2.35 2.35
- C. True 2.35 2.36
- D. True 2.35 2.35
Correct answer: D. True 2.35 2.35
0.1 * 0.1 is close enough to 0.01 that rounding to three places gives the same float. 2.345 and 2.355 are both stored a little below their midpoints, so each rounds down to 2.35.
More Python Programming questions
- What is printed? python print(max(1, 2.0, True), min([0.0, -0.0, 0]), sum([]) == 0.0)
- What is printed? python print(10100 // 1098, (10100) % 97 == pow(10, 100, 97))
- What is printed? python print(sorted(['b10', 'b9', 'a10'], key=lambda s: (s[0], int(s[1:]))))
- What is printed? python print(sorted('bAcB', key=str.upper), sorted('bAcB'))
- What is printed? python print(int('0' + '9' 3) + 1, int('9' 3 + '0') + 1)
- What is printed? python print(7 // 0.5, 7 % 0.5, -7 // 0.5)