ProgrammingVery hardJEE Advanced · CAT placement
What is printed?
What is printed?
print(10**400 > float('inf'), float('inf') > 10**400, float(10**308) == 10**308)- A. True False True
- B. False True True
- C. True True False
- D. False True False
Correct answer: D. False True False
No finite int is greater than infinity, but Python compares int and float exactly, and inf is above every int. 10**308 is not exactly a double, so float(10**308) is not equal to the int.
More Python Programming questions
- What is printed? python print('ab' in ['a', 'ab'], 'ab' in 'a,ab'.split(','), 'a' in 'abc' and 'ac' in 'abc')
- What is printed? python print(f'{-5:x}', f'{-5 & 0xF:x}', hex(-255), format(255, '#010b'))
- What is printed? python students = [('Ravi', 88), ('Asha', 92), ('Bala', 88), ('Chitra', 92)] print([n for n, s in sorted(students…
- What is printed? python print('Hello'[1:3] + 'Hello'[-1], len('Hello'[10:]), 'Hello'[::2])
- What is printed? python print(10 / 3 3 == 10, 10 // 3 3 == 10, 10 % 3)
- What is printed? python x = 0.1 + 0.2 print(x > 0.3, round(x, 15) == 0.3, x - 0.3 < 1e-9, '%.17g' % x)