ProgrammingHardProduct-company MCQ pattern

What is printed?

What is printed?
print(abs(-7) // 2 * -1, -abs(-7) // 2, -(abs(-7) // 2))
  1. A. -3 -4 -4
  2. B. -4 -4 -3
  3. C. -3 -4 -3
  4. D. -3 -3 -3

Correct answer: C. -3 -4 -3

abs(-7) // 2 is 3, and multiplying by -1 gives -3. -abs(-7) is -7, and floor division by 2 gives -4, which differs from negating 3.

More Python Programming questions

Exams that ask this topic