ProgrammingVery hardJEE Advanced · CAT placement
What is printed?
What is printed?
print(float('nan') != float('nan'), float('inf') == float('inf'), float('inf') - float('inf') == 0, -float('inf') < -1e308)- A. True True True True
- B. False True False True
- C. True True False True
- D. True False False True
Correct answer: C. True True False True
NaN is never equal to itself, and two infinities of the same sign are equal. inf minus inf is NaN, which is not equal to zero, and minus infinity is smaller than any finite number.
More Python Programming questions
- What is printed? python x = [1, 2, 3] y = x x = x + [4] print(y, x, y is x)
- What is printed? python print(int('٤٢'), '٤٢'.isnumeric(), ' 42n'.isdigit(), int('42n'))
- What is printed? python from collections import Counter c = Counter() c['a'] += 2 c.update('ab') print(c['a'], c['b'], c['z']…
- What is printed? python print(pow(2, 1018, 109 + 7) == pow(2, 1018 % (109 + 6), 109 + 7))
- What is printed? python print(7 // 0.5, 7 % 0.5, 0.5 7 // 1, 1e308 10 == float('inf'))
- What is printed? python print(sum([True, True, False]), True 3, 'ab' True, [0] True)