ProgrammingVery hardJEE Advanced · CAT placement

What is printed?

What is printed?
print(len(str(2**100)), str(2**100)[-3:], (2**100) % 1000)
  1. A. 31 267 376
  2. B. 30 376 376
  3. C. 31 376 276
  4. D. 31 376 376

Correct answer: D. 31 376 376

2**100 has 31 decimal digits and ends in 376, so both the slice and the modulus give 376.

More Python Programming questions

Exams that ask this topic