ProgrammingVery hardTCS NQT · Accenture

What is printed?

What is printed?
print(10 ** -1 == 0.1, 10 ** 0.5 == 10 ** (1 / 2), int(10 ** 0.5) ** 2 == 10, round(10 ** 0.5 * 10 ** 0.5, 9))
  1. A. True True True 10.0
  2. B. True False False 10
  3. C. True True False 10.0
  4. D. True True False 9.0

Correct answer: C. True True False 10.0

int() truncates 3.16 to 3, and 3 squared is 9, not 10. Multiplying the float square roots gives 10.0 after rounding, while 10 ** -1 is the same double as the literal 0.1.

More Python Programming questions

Exams that ask this topic