ProgrammingVery hardJEE Advanced · CAT placement

What is printed?

What is printed?
print(2 ** -1, 2 ** -1074 > 0, 10 ** -3 == 0.001, 10 ** -2)
  1. A. 0.5 False True 0.01
  2. B. 0.5 True True 0.01
  3. C. 0.5 True False 0.01
  4. D. 0.5 True True 0.1

Correct answer: B. 0.5 True True 0.01

A negative exponent on an int gives a float. 2 ** -1074 is the smallest subnormal double and is still positive. 10 ** -3 yields the nearest double to 0.001, which equals the literal.

More Python Programming questions

Exams that ask this topic