ProgrammingHardProduct-company MCQ pattern
What is printed?
What is printed?
import math print(math.gcd(2**40 - 1, 2**20 - 1) == 2**20 - 1, math.lcm(12, 18) == 36, math.gcd(10**30, 10**20) == 10**20)
- A. True True False
- B. False True True
- C. True False True
- D. True True True
Correct answer: D. True True True
2**20 - 1 divides 2**40 - 1 because 20 divides 40, so the gcd is the smaller value. Big ints give exact results, and 10**20 divides 10**30.
More Python Programming questions
- What is printed? python s = 'racecar level noon python' print([w for w in s.split() if w == w[::-1]], len([w for w in s.split() if w ==…
- What is printed? python s = 'aAbBcC' print(s.lower().count('a') + s.upper().count('A'), s.swapcase(), ''.join(c for c in s if c.islower()))
- What is printed? python s = '2024-06-01' y, m, d = map(int, s.split('-')) print(y + m + d, s.replace('-', '/'), '%02d/%02d/%04d' % (d, m…
- What is printed? python print('%d' % 1020, '%.3e' % (270), len('%d' % (2100)), '%x' % (270))
- 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)…