ProgrammingVery hardCodeforces-style · placement coding round
What is printed?
What is printed?
M = 1000000007 print(pow(2, -1, 7), pow(3, 4, 5), (pow(10, 9, M) * 2) % M)
- A. 4 1 2000000000
- B. 3 1 999999993
- C. 4 1 999999993
- D. 4 4 999999993
Correct answer: C. 4 1 999999993
pow(2, -1, 7) is the modular inverse of 2 modulo 7, which is 4 because 2 x 4 = 8 = 1 (mod 7). The last value is 2 x 10^9 reduced modulo M.
More Python Programming questions
- What is printed? python import math print(math.comb(10, 3), math.gcd(12, 18, 24), math.lcm(4, 6, 10))
- What is printed? python import itertools print(sum(b - a for a, b in itertools.pairwise([1, 4, 2, 8])))
- What is printed? python g = [[0] 3] 2 g[0][1] = 5 h = [[0] 3 for in range(2)] h[0][1] = 5 print(g, h)
- What is printed? python import heapq h = [] for w, name in [(2, 'b'), (1, 'z'), (2, 'a'), (1, 'c')]: heapq.heappush(h, (w, name)) out = []…
- What is printed? python recs = [('a', 2), ('b', 1), ('c', 2), ('d', 1)] print([n for n, v in sorted(recs, key=lambda r: r[1]…
- What is printed? python pairs = list(zip([1, 2, 3], 'ab', [True])) print(pairs, len(list(zip())))