ProgrammingHardProduct-company MCQ pattern

What is printed?

What is printed?
print(int('8' * 3) % 7, int('8' * 3, 16) % 7, pow(10, 3, 7), 888 % 7)
  1. A. 6 6 6 6
  2. B. 6 0 6 6
  3. C. 6 0 1 6
  4. D. 6 0 6 1

Correct answer: B. 6 0 6 6

888 is 7 * 126 + 6, so the remainder is 6. The hex value 0x888 is 2184, which is 7 * 312, so its remainder is 0. 10**3 is 1000, which leaves 6.

More Python Programming questions

Exams that ask this topic