ProgrammingHardProduct-company MCQ pattern
What is printed?
What is printed?
print(round(1234.5678, -2), round(-1234.5678, 2), round(0.000123456, 5))
- A. 1200.0 -1234.56 0.00012
- B. 1200.0 -1234.57 0.00012
- C. 1234.0 -1234.57 0.00012
- D. 1200.0 -1234.57 0.00013
Correct answer: B. 1200.0 -1234.57 0.00012
round with a negative digit count rounds to hundreds and still returns a float. Rounding -1234.5678 to two places gives -1234.57, and 0.000123456 rounds to 0.00012 at five places.
More Python Programming questions
- What is printed? python print(7 / 7, 0 / 5, -0 / 5, 2 0, 0 0.0)
- What is printed? python print(7 // 1.0 1, 1e3 // 7, -1e3 // 7, 10 % -3.0)
- What is printed? python print(bool(''), bool('False'), bool([]), bool([[]]), bool(None))
- What is printed? python print(str(3) + str(3.0), 3 + 3.0, '3' 3 == '333')
- What is printed? python y = 1 + 1 - 1 2 2 // 4 print(y, 2 2 0, (2 2) 0, -3 2 % 5)
- What is printed? python t = 'racecar' print(t == t[::-1], t.find('car'), t.rfind('c'), t.replace('car', 'CAR', 1))