ProgrammingVery hardJEE Advanced · CAT placement
What is printed?
What is printed?
print(5e-324 / 2 == 0, 2e-323 > 5e-324, float('1e-400'), 5e-324 / 2 == 0.0)- A. False True 0.0 True
- B. True False 0.0 True
- C. True True 1e-400 False
- D. True True 0.0 True
Correct answer: D. True True 0.0 True
5e-324 is the smallest positive double. Half of it is exactly halfway to zero, and round-half-to-even sends it to 0.0. Any decimal below the smallest subnormal also underflows to 0.0.
More Python Programming questions
- What is printed? python import math print(int(-0.5), int(-1.9), math.floor(-1.1), round(-1.5))
- What is printed? python print(7 & -8, 7 | -8, 7 ^ -8, ~7 & 0xFF)
- What is printed? python print(float(' 1000.5 '), float('infinity') > 1e308, float('-nan') != float('-nan'), int(' +0012 '))
- What is printed? python print(b'abc'[0], bytes([65, 66]), bytes.fromhex('41 42'), len(b'a' 2 + b'x00'))
- What is printed? python print(sorted(['b', 'A', 'c', 'B'], key=str.casefold, reverse=True))
- What is printed? python try: print(sorted([3, None, 1])) except TypeError: print('cannot compare')