ProgrammingVery hardProduct-company MCQ pattern
What is printed?
What is printed?
print(max(-0.0, 0), min(0, -0.0), -0.0 + 0, 0 - 0.0)
- A. -0.0 1 0.0 0.0
- B. -0.0 0 0.0 0.0
- C. -0.0 0 1.0 0.0
- D. -0.0 0 0.0 2.0
Correct answer: B. -0.0 0 0.0 0.0
max and min return the first item when values compare equal, so max(-0.0, 0) keeps -0.0 and min(0, -0.0) keeps 0. Adding an int 0 to -0.0 gives +0.0, and 0 - 0.0 is +0.0.
More Python Programming questions
- What is printed? python a = 10 b = 3 print(a / b b == a, a // b b + a % b == a, a % b / b == (a / b) % 1)
- What is printed? python print(7 % 3 2, (7 % 3) 2, -7 % 3 2, 2 3 2 % 4)
- What is printed? python print(len(' a b '.split()), len(' a b '.split(' ')), len('anbn'.splitlines()), len('anbn'.split('n')))
- What is printed? python print(list('abc'.encode()), 'abc'.encode()[0] + 1, bytes('hi', 'ascii') == b'hi')
- What is printed? python x = 17 print(x.bitlength(), (x & -x).bitlength(), x.bitcount(), bin(x)[2:].zfill(8))
- What is printed? python print(int(2.5 4) // 3, int(10 / 4 2), 10 // 4 2, 10 / 4 // 2)