ProgrammingHardProduct-company MCQ pattern
What is printed?
What is printed?
print(max(1, 2.0, True), min([0.0, -0.0, 0]), sum([]) == 0.0)
- A. 2.0 0.0 True
- B. 2.0 0.5 True
- C. 1 0.0 True
- D. 2.0 0.0 False
Correct answer: A. 2.0 0.0 True
max returns 2.0 because it is the largest value. min keeps the first of the equal zeros, which is 0.0, and sum of an empty list is the int 0, which equals 0.0.
More Python Programming questions
- What is printed? python print(10100 // 1098, (10100) % 97 == pow(10, 100, 97))
- What is printed? python print(sorted(['b10', 'b9', 'a10'], key=lambda s: (s[0], int(s[1:]))))
- What is printed? python print(sorted('bAcB', key=str.upper), sorted('bAcB'))
- What is printed? python print(int('0' + '9' 3) + 1, int('9' 3 + '0') + 1)
- What is printed? python print(7 // 0.5, 7 % 0.5, -7 // 0.5)
- What is printed? python print(0.5 1074 == 0, 5e-324 > 0, 5e-324 / 2 == 0)