ProgrammingVery hardJEE Advanced · CAT placement
What is printed?
What is printed?
print(int(float(2**53)) == 2**53, float(2**53 + 1) - 2**53, (2**53 + 1) - 2**53)
- A. True 1.0 1
- B. False 0.0 1
- C. True 0.0 1
- D. True 0.0 0
Correct answer: C. True 0.0 1
2**53 + 1 rounds to 2**53 as a float, so the float difference is 0.0. Integer arithmetic is exact, so the int difference is 1.
More Python Programming questions
- What is printed? python print('a'.join('xyz'), 'xyz'.join(['a']), 'ab'.join(['', '']), ','.join(map(str, [1.0, 2])))
- What is printed? python print(round(0.5 3), round(4.5) + round(5.5), int(2.9999999999999996), int(3.0000000000000004))
- What is printed? python print('Python' 0 + 'x', 'Py' + 'thon' 0, len('' 100))
- What is printed? python print(len(str(2100)), str(2100)[-3:], (2100) % 1000)
- What is printed? python x = 5 x += 2 x print(x, x - 2 3 2 // 9 1, x // 4 4 + x % 4)
- What is printed? python print([i for i in range(10) if i % 3 == 0][::-1], [i i for i in range(5)][-2:], len([]) == 0)