ProgrammingHardTCS NQT · Infosys
What is printed?
What is printed?
print(-2**63 // -1 == 2**63, abs(-2**63) == 2**63, (2**63) * (2**63) > 2**127, 2**63 * 2**63 == 2**126)
- A. True True False True
- B. True True True True
- C. True False False True
- D. True True False False
Correct answer: A. True True False True
Python ints never overflow, so 2**63 squared is exactly 2**126, which is less than 2**127. Dividing -2**63 by -1 gives 2**63 with no wraparound.
More Python Programming questions
- What is printed? python print(int(1e22) == 1022, int(1e23) == 1023, float(1022) == 1e22)
- What is printed? python print('{:+}'.format(-0.0), '{:+}'.format(0), '{:+.1f}'.format(-0.04), '{:+}'.format(5))
- What is printed? python print(hex(255).upper(), int('FF', 16) == 0xff, '%X' % 255 == hex(255)[2:].upper(), oct(64))
- What is printed? python print(0.1 + 0.2 != 0.3, 1 if 0.1 + 0.2 else 0, 0.0 or -0.0 or 'x', 0 and 1 or 2)
- What is printed? python print(len('u0301'), len('au0301'), 'au0301'.upper() == 'Au0301')
- What is printed? python words = 'the quick the lazy'.split() counts = {} for w in words: counts[w] = counts.get(w, 0) + 1 print(counts…