ProgrammingVery hardProduct-company MCQ pattern
What is printed?
What is printed?
print(int(1e308) > 10**308, float('1e-400'), 5e-324 / 2, 5e-324 / 2 == 0)- A. False 0.0 0.0 True
- B. True 0.0 5e-324 True
- C. True 0.0 0.0 False
- D. True 0.0 0.0 True
Correct answer: D. True 0.0 0.0 True
The float 1e308 is stored as a binary value slightly above the decimal one, so int of it exceeds 10**308. Halving the smallest subnormal rounds to zero, which is a tie to even.
More Python Programming questions
- What is printed? python print(1e-7 == 0.0000001, 1e-7, 0.0000001, 1.0e5 == 100000.0, 123e-2)
- What is printed? python print(7 // 2 2 + 7 % 2 == 7, -(7 // 2) 2 + -(7 % 2) == -7, (-7) // 2 2 + (-7) % 2)
- What is printed? python print(int('12' '34') + 1, '%d' % 3.9, '%i' % -3.9, '%+d' % 0)
- Which approach removes duplicates from a list while keeping the first-seen order, in O(n) average time?
- Which statement about sorting 10^6 floats with sorted() in CPython is correct?
- Which operation is O(1) amortised in CPython?