ProgrammingVery hardProduct-company MCQ pattern
What is printed?
What is printed?
print(int('9' * 5) ** 2 // 10**9, (10**9 - 1) ** 2 // 10**9)- A. 9 999999999
- B. 8 999999998
- C. 9 1000000000
- D. 9 999999998
Correct answer: D. 9 999999998
99999 squared is 9999800001, and dividing by 10**9 floors to 9. (10**9 - 1) squared is 10**18 - 2 * 10**9 + 1, which floors to 999999998.
More Python Programming questions
- What is printed? python x = 0 for i in range(1, 101): x += i print(x, x // 2 2 == x, x % 2)
- What is printed? python print(','.join(['a', 'b']), ','.join('ab'), '%s' % ['a', 'b'], str(('a',)))
- What is printed? python import math print(math.prod([2, 3, 4]), math.prod([]), math.prod([1.5, 2]), math.prod(range(1, 6)) ==…
- What is printed? python words = ['bb', 'a', 'ccc'] print(max(words), max(words, key=len), min(words, key=len), sorted(words, key=lambda w…
- What is printed? python print(len(f'{1234.5:.0f}'), f'{1234.5:.0f}', f'{1235.5:.0f}', f'{-1234.5:.0f}')
- What is printed? python print(1e3 == 103, int(1e3) is not None, 1e3 // 1 == 103, type(1e3 // 1).name)