ProgrammingVery hardJEE Advanced · CAT placement

What is printed?

What is printed?
print(7 ** -1 == 1 / 7, pow(7, -1, 13) * 7 % 13, (7 ** 2) % 13, 2 ** 3 ** 2 % 10)
  1. A. False 1 10 2
  2. B. True 1 10 8
  3. C. True 1 10 2
  4. D. True 2 10 2

Correct answer: C. True 1 10 2

7 ** -1 is computed as a float, the same as 1 / 7. The inverse of 7 mod 13 is 2 since 14 is 1 mod 13. ** is right-associative, so 2 ** 3 ** 2 is 2 ** 9 = 512, which ends in 2.

More Python Programming questions

Exams that ask this topic