ProgrammingVery hardTCS CodeVita · Infosys HackWithInfy

What is printed?

What is printed?
print(2 ** 200 % 7 == pow(2, 200, 7), len(str(2 ** 200)), 2 ** 200 % 7)
  1. A. False 61 4
  2. B. True 60 4
  3. C. True 61 4
  4. D. True 61 2

Correct answer: C. True 61 4

2 cubed is 8, which is 1 mod 7. Since 200 mod 3 = 2, 2**200 is congruent to 2**2 = 4 modulo 7. 2**200 has 61 digits.

More Python Programming questions

Exams that ask this topic