ProgrammingModerateTCS NQT · Accenture

What is printed?

What is printed?
print(abs(-0), abs(-2.5), -(-3))
  1. A. 0 -2.6 3
  2. B. 0 2.5 -4
  3. C. 0 2.5 3
  4. D. 1 2.5 3

Correct answer: C. 0 2.5 3

abs returns the magnitude of its argument, and negating -3 gives 3.

More Python Programming questions

Exams that ask this topic