ProgrammingHardTCS NQT · Accenture
What is printed?
What is printed?
print(len(str(2**1000)), sum(map(int, str(2**1000))))
- A. 301 1366
- B. 302 1364
- C. 302 1366
- D. 303 1366
Correct answer: C. 302 1366
2**1000 has 302 decimal digits, since 10**301 is the smallest 302-digit number and 2**1000 is about 1.07e301. Its digit sum is 1366, a standard check value.
More Python Programming questions
- What is printed? python print(1018 10 // 1018 == 10, type(1018 / 1018))
- What is printed? python print(round(1.005, 2), round(0.285, 2), round(1.45, 1))
- What is printed? python print('abcdef'[4:1:-2], 'abc'[::-2], 'abc'[-5:], 'abc'[5:] == '')
- What is printed? python import cmath print((-1) 0.5 == 1j, -1 0.5, (-1) 0.5)
- What is printed? python print((-7) % 3, 7 % -3, (-7) % -3, -7 % 3 2)
- What is printed? python print(-6 & 0xFF, -6 | 3, -6 ^ -3, ~-6 >> 1)