ProgrammingVery hardTCS CodeVita · Infosys HackWithInfy

What is printed?

What is printed?
print(10 ** 18 % 7, (10 ** 18 + 2) // 4, -(2 ** 63) // (2 ** 62))
  1. A. 1 250000000000000000 -2
  2. B. 1 250000000000000001 -2
  3. C. 2 250000000000000000 -2
  4. D. 1 250000000000000000 -1

Correct answer: A. 1 250000000000000000 -2

10**18 mod 7 is 1 because 10 mod 7 is 3, and 3**18 mod 7 equals 1 by Fermat's little theorem. (10**18 + 2) // 4 is 250000000000000000 exactly, and -(2**63) // 2**62 is -2.

More Python Programming questions

Exams that ask this topic