ProgrammingHardProduct-company MCQ pattern
What is printed?
What is printed?
print(str(10 ** 15 / 10), str(10 ** 16 / 10), 10 ** 16 // 10)
- A. 1e+14 1e+15 1000000000000000
- B. 100000000000000.0 1e+15 1000000000000000
- C. 100000000000000 1000000000000000.0 1000000000000000
- D. 100000000000000.0 1000000000000000.0 1000000000000000
Correct answer: D. 100000000000000.0 1000000000000000.0 1000000000000000
Floats below 1e16 print in full decimal form, so 1e14 and 1e15 appear as 100000000000000.0 and 1000000000000000.0. Floor division of two ints stays an int.
More Python Programming questions
- What is printed? python print('%.3g' % 0.0001234, '%.3g' % 123456.0, '%g' % 0.5)
- What is printed? python print(max('7', '10'), max(7, 10), min('7', '10'), '7' > '10')
- What is printed? python print(len(f'{3.5:>8.2f}'), f'{-3.5:08.1f}', f'{12:#06x}', f'{7:+05d}')
- What is printed? python print('abc'.encode() == b'abc', b'abc'.decode() == 'abc', 'é'.encode('utf-8') == b'xc3xa9', len(b'xc3xa9'.decode()))
- What is printed? python print('%.3s' % 'abcdef' + '|' + '%-4d|' % 7 + '%04.1f' % 2.25)
- What is printed? python x = 0xFF print(x >> 4, x & 0xF0, x ^ 0x0F, ~x & 0xFF)