ProgrammingVery hardCAT · MBA placement
What is printed?
What is printed?
print(round(1234, -2), round(1250, -2), round(1350, -2))
- A. 1200 1300 1400
- B. 1200 1300 1300
- C. 1200 1200 1300
- D. 1200 1200 1400
Correct answer: D. 1200 1200 1400
round with a negative digit count rounds to tens or hundreds using round-half-to-even. 1250 is exactly halfway between 1200 and 1300, so it goes to the even hundred, 1200, and 1350 goes up to 1400.
More Python Programming questions
- What is printed? python def lcsub(a, b): best = end = 0 dp = [[0] (len(b) + 1) for in range(len(a) + 1)] for i in range(1, len(a) + 1)…
- A solution must decide whether a number n up to 10^12 is prime within about one second in CPython. Which approach is correct and fast…
- What is printed? python d = {'a': 1, 'b': 2} print(d.popitem(), d)
- What is printed? python print('{0}{1}{0}'.format('x', 'y'))
- What is printed? python print(list(filter(None, [0, '', [], [0], None])))
- What is printed? python print([i for i in range(10) if i % 3 == 0][::-2])