ProgrammingHardGATE CS · Product-company placement

What is printed?

What is printed?
import sys
print(type(10 ** 20).__name__, 10 ** 20 // 3 % 10, len(str(2 ** 100)), (2 ** 64) - 1 == 0xFFFF_FFFF_FFFF_FFFF)
  1. A. long 3 31 True
  2. B. int 3 30 True
  3. C. int 3 31 True
  4. D. OverflowError

Correct answer: C. int 3 31 True

index finds the first 'c' (2), rindex the last (4), and find with start 3 skips index 2 to find 4. The reversed slice is a new string object, so `is` is False. count from index 2 sees only the 'a' at index 5.

More Python Programming questions

Exams that ask this topic