ProgrammingVery hardProduct-company MCQ pattern
What is printed?
What is printed?
print(pow(7, 222, 10), pow(7, 222, 1000), 7**222 % 1000, pow(-7, 3, -5))
- A. 9 49 49 -2
- B. 9 51 49 -3
- C. 9 49 41 -3
- D. 9 49 49 -3
Correct answer: D. 9 49 49 -3
7 to the power 4 is 1 mod 10, and 222 mod 4 is 2, so the first value is 49 mod 10 = 9. A negative modulus gives a result in the range (modulus, 0], so -343 mod -5 is -3.
More Python Programming questions
- What is printed? python print(int(True) + int('0b11', 2), int(3.7 // 1), int(-0.5), round(-0.5), round(0.5))
- What is printed? python n = 0b10110000 print(n & -n, n & (n - 1), bin(n >> 4), n.bitcount())
- What is printed? python a, b = 5, 9 a ^= b b ^= a a ^= b print(a, b, a ^ b)
- What is printed? python print(0xFF >> 4 << 4 == 0xF0, 1 << 63 > 0, (1 << 63) - 1 == 263 - 1, -(1 << 63) >> 63)
- What is printed on the third line? python names = ['bob', 'Alice', 'carl', 'Bob', 'alice'] print(sorted(names)) print(sorted(names…
- What is printed? python x = 253 print(float(x + 1) == x, x + 1.0 == x, (x + 2.0) - x, int(float(x + 3)) - x)