ProgrammingHardProduct-company MCQ pattern

What is printed?

What is printed?
print(int(True) + int('0b11', 2), int(3.7 // 1), int(-0.5), round(-0.5), round(0.5))
  1. A. 4 3 0 0 0
  2. B. 3 3 0 0 0
  3. C. 4 3 -1 0 0
  4. D. 4 3 0 -1 0

Correct answer: A. 4 3 0 0 0

int('0b11', 2) accepts the prefix and gives 3, and int(True) is 1. int truncates -0.5 to 0, and round uses half-to-even, so round(-0.5) and round(0.5) are both 0.

More Python Programming questions

Exams that ask this topic