ProgrammingHardTCS CodeVita · Infosys HackWithInfy

What is printed?

What is printed?
print(divmod(-9, 4), -9 // 4, -9 % 4, round(-9 / 4))
  1. A. (-3, 3) -2 3 -3
  2. B. (-3, 3) -3 3 -2
  3. C. (-2, 3) -2 3 -2
  4. D. (-3, -1) -3 -1 -2

Correct answer: B. (-3, 3) -3 3 -2

divmod(-9, 4) is (-3, 3) because -3 * 4 + 3 = -9. -9 / 4 is -2.25, which rounds to -2.

More Python Programming questions

Exams that ask this topic