ProgrammingHardProduct-company MCQ pattern
What is printed?
What is printed?
print(len(str(2**64)), 2**64 // 10**19, 2**64 % 10**19, len(str(2**64 - 1)))
- A. 20 1 8446744073709551615 20
- B. 19 1 8446744073709551616 20
- C. 20 1 8446744073709551616 20
- D. 20 2 8446744073709551616 20
Correct answer: C. 20 1 8446744073709551616 20
2**64 is 18446744073709551616, which has 20 digits. Integer floor division and modulus by 10**19 split off the leading digit, leaving 8446744073709551616.
More Python Programming questions
- What is printed? python print(-7 // 2 2 + -7 % 2 == -7, 7 // -2 -2 + 7 % -2 == 7, -(-7 // 2))
- What is printed? python x = 0b1011 print(bin(x << 3), bin(x >> 1), x << 3 >> 3 == x, bin(~x & 0b1111))
- What is printed? python print(3 'ab' == 'ab' 3, 'ab' 3 == 'aba' + 'bab', [0] 3 == [0, 0, 0], ['a'] 2 == 'aa')
- What is printed? python s = 'The Quick' print(s.lower().split(), s.split('Q')[0].strip(), s[s.index(' ') + 1:], s.title().swapcase())
- What is printed? python print('%d items at %.1f%%' % (3, 12.345), '%5.2f|' % -1.005, '%08.3f' % -3.14159)
- What is printed? python print(int('12') 2 3, float('12e3') // 1000, float('1000.5e1'))