ProgrammingHardProduct-company MCQ pattern

What is printed?

What is printed?
print(2 ** 0.5 * 2 ** 0.5 == 2, round(2 ** 0.5 * 2 ** 0.5, 12) == 2)
  1. A. True True
  2. B. False True
  3. C. False False
  4. D. True False

Correct answer: B. False True

The square of the float square root is 2.0000000000000004, so the exact test fails. Rounding to twelve places brings it back to 2.0.

More Python Programming questions

Exams that ask this topic