ProgrammingVery hardTCS NQT · Accenture

What is printed?

What is printed?
print(len('%.3f' % 2**60), '%.3f' % 2**60, '%.0f' % 1e20)
  1. A. 23 1152921504606846976.000 100000000000000000000
  2. B. 22 1152921504606846976.000 100000000000000000000
  3. C. 23 1152921504606846976.00 100000000000000000000
  4. D. 23 1152921504606846976.000 1e+20

Correct answer: A. 23 1152921504606846976.000 100000000000000000000

2**60 is exactly representable as a double, and %.3f prints its 19 integer digits plus a decimal point and three zeros, which is 23 characters. %.0f expands 1e20 into the full integer.

More Python Programming questions

Exams that ask this topic