ProgrammingModerateTCS NQT · Infosys

What is printed?

What is printed?
print(len(''.join(str(i) for i in range(1, 11))), ''.join(str(i) for i in range(1, 11))[-3:], sum(len(str(i)) for i in range(1, 11)))
  1. A. 10 910 11
  2. B. 11 109 11
  3. C. 11 910 11
  4. D. 11 910 10

Correct answer: C. 11 910 11

Ten numbers contribute nine one-digit numbers and one two-digit 10, giving 11 characters. The last three characters are 9, 1 and 0, which spell 910.

More Python Programming questions

Exams that ask this topic