ProgrammingModerateTCS NQT · Infosys

What is printed?

What is printed?
print(max([], default=-1), min([3], default=0), sum([]), sum([], 0.0), any([]) or all([]))
  1. A. -1 3 0 0 True
  2. B. -1 3 0 0.0 False
  3. C. -1 3 0 0.0 True
  4. D. 0 3 0 0.0 True

Correct answer: C. -1 3 0 0.0 True

max and min accept a default for empty input, so max([], default=-1) is -1. sum([]) is the int 0, but sum([], 0.0) returns the float start value. any([]) is False and all([]) is True, so the or gives True.

More Python Programming questions

Exams that ask this topic