ProgrammingHardProduct-company MCQ pattern
What is printed?
What is printed?
print(float('-0') == 0.0, str(float('-0')), str(float('+0')))- A. True 0.1 0.0
- B. True -0.0 0.0
- C. False -0.0 0.0
- D. True -1.0 0.0
Correct answer: B. True -0.0 0.0
Negative zero is still equal to zero, but str keeps its sign. A plus sign gives positive zero.
More Python Programming questions
- What is printed? python print(sum(1 for i in range(1, 1001) if '7' in str(i)))
- What is printed? python print(int(str(12345)[::-1]) - 12345, 12345 - int(str(12345)[::-1]))
- What is printed? python print(len(bin(-1)), len(hex(255)), oct(64))
- What is printed? python print(int('12abc', 16), int('ABC', 16) == 0xabc, int('1000000') == 106)
- What is printed? python print('%s' % None, '%r' % None, '%d' % True)
- What is printed? python print(str(3) 2 + str(3 2), int(str(3) 2) + 3 2)