ProgrammingModerateProduct-company MCQ pattern
What is printed on the second line?
What is printed on the second line?
import math print(math.gcd(12, 18, 24), math.gcd(), math.lcm(), math.lcm(4, 0, 9)) print(math.isqrt(99), math.isqrt(100), int(99 ** 0.5))
- A. 9 10 9
- B. 9 10 10
- C. 9 9 9
- D. 8 10 9
Correct answer: A. 9 10 9
isqrt returns the floor of the exact square root, so isqrt(99) is 9 and isqrt(100) is 10. int(99 ** 0.5) also gives 9 because 99 ** 0.5 is about 9.95.
More Python Programming questions
- Which line is printed? python print(divmod(270, 106)[1] == 270 % 106, divmod(-270, 106)[1] == (-270) % 106, (-270) // 106 == -(270 // 106)…
- What is printed? python from collections import Counter print(Counter('mississippi').mostcommon(3))
- What is printed? python from functools import lrucache @lrucache(None) def total(xs): return sum(xs) try: print(total([1, 2, 3])) except…
- What is printed? python import bisect print(bisect.bisectleft(range(100), True, key=lambda x: x x >= 50))
- What is printed? python n = 30 s = [True] (n + 1) s[0] = s[1] = False for i in range(2, int(n 0.5) + 1): if s[i]: s[i i::i] = [False]…
- What is printed? python print(-0.0 == 0.0, str(-0.0), repr(0.0 -1))