ProgrammingVery hardTCS CodeVita · Infosys HackWithInfy

What is printed?

What is printed?
print(pow(10, 100, 7), pow(2, 10, 1000), pow(7, 0, 7))
  1. A. 4 1024 0
  2. B. 3 24 1
  3. C. 4 24 0
  4. D. 4 24 1

Correct answer: D. 4 24 1

Since 10 = 3 mod 7 and 3 has order 6 mod 7, 3**100 = 3**4 = 81 = 4 mod 7. 2**10 = 1024 mod 1000 is 24. Modulo 7, pow(7, 0, 7) is 1 because 7**0 = 1 and 1 mod 7 is 1.

More Python Programming questions

Exams that ask this topic