ProgrammingHardGATE CS · Product-company placement

What is printed?

What is printed?
print(len(str(2**1000)), sum(int(d) for d in str(2**100)))
  1. A. 301 115
  2. B. 302 116
  3. C. 302 115
  4. D. 303 115

Correct answer: C. 302 115

2 to the power 1000 has floor(1000 * log10(2)) + 1 = 302 digits, and the digit sum of 2 to the power 100 is 115.

More Python Programming questions

Exams that ask this topic