ProgrammingHardProduct-company MCQ pattern

What is printed?

What is printed?
print(divmod(10, 3)[::-1], divmod(-10, 3)[::-1], divmod(10, -3)[::-1])
  1. A. (1, 3) (2, -4) (-2, -4)
  2. B. (1, 3) (-4, 2) (-4, -2)
  3. C. (3, 1) (2, -4) (-2, -4)
  4. D. (1, 3) (2, -4) (-4, -2)

Correct answer: A. (1, 3) (2, -4) (-2, -4)

divmod(-10, 3) is (-4, 2), and reversing it gives (2, -4). divmod(10, -3) is (-4, -2), so reversed it is (-2, -4).

More Python Programming questions

Exams that ask this topic