ProgrammingVery hardProduct-company MCQ pattern
What is printed?
What is printed?
print(pow(3, 10**18, 7), pow(3, 6, 7), pow(3, 10**18 % 6, 7))
- A. 4 1 4
- B. 4 1 1
- C. 2 1 4
- D. 4 6 4
Correct answer: A. 4 1 4
3 has order 6 modulo 7, so the exponent only matters mod 6. 10**18 mod 6 is 4, and 3 to the power 4 is 81, which is 4 mod 7.
More Python Programming questions
- What is printed? python print(sum(range(10)) / len(range(10)), sum(range(10)) // len(range(10)), sum(range(1, 11)) % 7)
- What is printed? python n = 12345 print(n // 10 3 % 10, n % 10 3 // 100, str(n)[1], n // 1000 % 10 == int(str(n)[1]))
- What is printed? python import math print(math.gcd(240 - 1, 220 - 1) == 220 - 1, math.lcm(12, 18) == 36, math.gcd(1030, 1020) == 1020)
- 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…