ProgrammingVery hardGATE CS · Product-company placement

What is printed?

What is printed?
print(max([1, 2], [1, 2, 0]), min("Z", "a", "_"), sorted([True, 0, -1, 0.5]), max(3, 3.0), max(3.0, 3))
  1. A. [1, 2] _ [-1, 0, 0.5, True] 3.0 3
  2. B. [1, 2, 0] Z [-1, 0, 0.5, True] 3 3.0
  3. C. [1, 2, 0] _ [-1, 0, 0.5, 1] 3 3.0
  4. D. [1, 2, 0] Z [-1, 0, True, 0.5] 3.0 3.0

Correct answer: B. [1, 2, 0] Z [-1, 0, 0.5, True] 3 3.0

Lists compare lexicographically and a longer list with an equal prefix is larger. 'Z' (90) < '_' (95) < 'a' (97). True sorts as 1. On ties max returns the FIRST maximal argument, so 3 then 3.0.

More Python Programming questions

Exams that ask this topic