ProgrammingHardTCS NQT · Infosys

What is printed?

What is printed?
print(abs(-0.0), abs(-3), abs(True), abs(-2 ** 63))
  1. A. 0 3 1 9223372036854775808
  2. B. 0.0 3 True 9223372036854775808
  3. C. 0.0 3 1 9223372036854775808
  4. D. 0.0 3 1 9223372036854775807

Correct answer: C. 0.0 3 1 9223372036854775808

abs of -0.0 is the float 0.0, and abs of -3 is 3. abs(True) is the integer 1, and the integer 2**63 has no overflow in Python.

More Python Programming questions

Exams that ask this topic