ProgrammingVery hardJEE Advanced · CAT placement
What is printed?
What is printed?
print(len(str(2**100)), str(2**100)[-3:], (2**100) % 1000)
- A. 31 267 376
- B. 30 376 376
- C. 31 376 276
- 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
- What is printed? python x = 5 x += 2 x print(x, x - 2 3 2 // 9 1, x // 4 4 + x % 4)
- What is printed? python print([i for i in range(10) if i % 3 == 0][::-1], [i i for i in range(5)][-2:], len([]) == 0)
- What is printed? python print('%.2f' % 1.255, '%.2f' % 1.245, '%.1f' % 0.05, '%.1f' % 0.15)
- What is printed? python print(str(1e-4), str(1e-5), str(123456789.0), str(1234567890123456789.0))
- What is printed? python print(18 // 4 if False else 'na', 'na' 2 + 'ba')
- What is printed? python print(all(c.islower() for c in 'abc'), any(c.isdigit() for c in 'abc'), 'abc'.isascii() and 'é'.isascii())