ProgrammingVery hardProduct-company MCQ pattern
What is printed?
What is printed?
print('%d' % 10**20, '%.3e' % (2**70), len('%d' % (2**100)), '%x' % (2**70))- A. 100000000000000000000 1.181e+20 31 400000000000000000
- B. 100000000000000000000 1.181e+21 30 400000000000000000
- C. 100000000000000000000 1.181e+21 31 40000000000000000
- D. 100000000000000000000 1.181e+21 31 400000000000000000
Correct answer: D. 100000000000000000000 1.181e+21 31 400000000000000000
2**70 is about 1.181e21, and 2**100 has 31 digits. In hex, 2**70 is a 4 followed by 17 zeros, since 70 = 2 + 4 * 17.
More Python Programming questions
- What is printed? python print(int(float('9007199254740993')) == 9007199254740993, float('9007199254740993') == 9007199254740992.0…
- What is printed? python nums = [3, 1, 4, 1, 5, 9, 2, 6] print(sorted(nums)[len(nums) // 2], sorted(nums)[(len(nums) - 1) // 2], sum(nums)…
- What is printed? python print(sum([0.1] 3) == 0.3, sum([0.1] 3, 0.0) == 0.30000000000000004, sum([1e100, 1.0, -1e100]))
- What is printed? python print(-(2 3) 2, (-2) 3 2, -2 -1, 0)
- What is printed? python print(7 & 3 << 1, 7 & (3 << 1), 6 | 1 << 2, (6 | 1) << 2)
- What is printed? python print(~0, ~-1, -~0, ~~5, -~-5)