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

Exams that ask this topic