ProgrammingHardProduct-company MCQ pattern

What is printed?

What is printed?
print(sum(range(10**6)) == 10**6 * (10**6 - 1) // 2, 2**0.5 * 2**0.5 == 2.0, 2**0.5 * 2**0.5)
  1. A. True True 2.0000000000000004
  2. B. True False 2.0000000000000004
  3. C. False False 2.0000000000000004
  4. D. True False 2.0

Correct answer: B. True False 2.0000000000000004

The integer sum matches the closed formula exactly because Python ints do not overflow. Square roots are inexact in binary floating point, so the product is 2.0000000000000004 rather than 2.0.

More Python Programming questions

Exams that ask this topic