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))
  1. A. 9 49 49 -2
  2. B. 9 51 49 -3
  3. C. 9 49 41 -3
  4. 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

Exams that ask this topic