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)
- A. True True
- B. False True
- C. False False
- 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
- What is printed? python print(''.join(reversed('ab' 2)), 'ab'[::-1] 2 == 'baba')
- Which operation is O(1) on average in CPython?
- A loop runs s += c for 100000 single characters in CPython. Which statement is most accurate?
- Which statement about converting a string to an int in Python 3.13 is correct?
- What relative and absolute tolerances does math.isclose use by default?
- Which key sorts records by score descending and then by name ascending, using one stable sort?