ProgrammingModerateTCS NQT · Infosys
What is printed?
What is printed?
print(sum(map(int, str(2**20))), len(str(3**50)), str(10**5)[::-1].count('0'))- A. 31 23 5
- B. 30 24 5
- C. 31 24 4
- D. 31 24 5
Correct answer: D. 31 24 5
The digits of 2**20 = 1048576 sum to 31, and 3**50 has 24 digits. Reversing '100000' gives '000001', which has five zeros.
More Python Programming questions
- What is printed? python print(float('0.1') + float('0.2') == float('0.30000000000000004'), 0.1 + 0.2 == 0.30000000000000004)
- What is printed? python print(5 // 0.4, 5 % 0.4, 0.4 12 == 4.8, 5 / 0.4)
- What is the time complexity of s[::-1] for a string of length n in CPython?
- Which call builds one string from n pieces in O(total length) time?
- Which statement about sorting in Python is correct?
- What is printed? python print(oct(-8), hex(-255), bin(0), format(-5, 'b'))