ProgrammingModerateTCS NQT · Infosys

What is printed?

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

Correct answer: A. True True

The identity a == (a // b) * b + a % b holds for all signs in Python, so both checks are True.

More Python Programming questions

Exams that ask this topic