ProgrammingVery hardTCS NQT · Accenture
What is printed?
What is printed?
print(1000000 * 1000000 == 10**12, 0.1 * 0.1 * 100 == 1, round(0.1 * 0.1 * 100, 10) == 1.0, 2 ** 0.5 == 2 ** (1 / 2))
- A. True False True True
- B. True True True True
- C. False False True True
- D. True False False True
Correct answer: A. True False True True
Integer multiplication is exact, so the first check is True. 0.1 * 0.1 * 100 is just above 1, and rounding to ten places fixes it. ** with 0.5 and 1 / 2 is the same exponent.
More Python Programming questions
- What is printed? python print(sum(range(0, 101, 5)), len(range(0, 101, 5)))
- What is printed? python print(bin(37)[2:].zfill(8), int('100101', 2) == 37)
- What is printed? python import heapq h = [] for x in [5, 2, 8]: heapq.heappush(h, x) print(heapq.heappop(h), heapq.heappop(h), h)
- What is printed? python print(sorted([3, 1, 2], key=lambda x: -x)[0], max([3, 1, 2], key=lambda x: -x))
- What is printed? python print([x for x in range(20) if x % 3 == 0 and x % 4 == 0])
- What is printed? python print(len({(i, j) for i in range(3) for j in range(3) if i <= j}))