ProgrammingModerateTCS NQT · Infosys

What is printed?

What is printed?
print(int('12') * 2 ** 3, float('12e3') // 1000, float('1_000.5e1'))
  1. A. 96 12.0 10005.0
  2. B. 96 12 10005.0
  3. C. 96 12.0 1000.5
  4. D. 96 24.0 10005.0

Correct answer: A. 96 12.0 10005.0

2 ** 3 is 8, so 12 * 8 is 96. float() accepts underscores and exponents, and floor division of a float returns a float, so 12e3 // 1000 is 12.0.

More Python Programming questions

Exams that ask this topic