ProgrammingModerateTCS NQT · Infosys

What is printed?

What is printed?
print(10 ** 2 == 100.0, 2 ** 0.5 ** 2 == 2 ** 0.25, pow(4, 0.5))
  1. A. True True 2.0
  2. B. True True 2
  3. C. True False 2.0
  4. D. False True 2.0

Correct answer: A. True True 2.0

Exponentiation is right-associative, so 2 ** 0.5 ** 2 is 2 ** 0.25. pow with a float exponent returns a float, so pow(4, 0.5) is 2.0.

More Python Programming questions

Exams that ask this topic