ProgrammingHardTCS NQT · Infosys
What is printed?
What is printed?
print(int('12') + int('3'), '12' + '3', 12 + 3 == int('15'), 'x')- A. 15 123 False x
- B. 15 15 True x
- C. 123 15 True x
- D. 15 123 True x
Correct answer: D. 15 123 True x
int('12') + int('3') is 15, while '12' + '3' concatenates the strings to 123. 12 + 3 equals int('15'), so the comparison is True.
More Python Programming questions
- What is printed? python s = 'Python' print(s[0], s[-1], s[1:4], s[::2])
- What is printed? python print(len([1, 2, 3] 2), [1, 2] + [3], [0] 0, [[0] 2] 2 == [[0, 0], [0, 0]])
- What is printed? python print('Hello'.lower() == 'hello', 'Hello'.islower(), 'hello'.isalpha(), 'h3llo'.isalnum())
- What is printed? python print(0.1 + 0.2 > 0.3, round(0.1 + 0.2, 2) == 0.3, 3 0.1 == 0.3, 1 / 3 3 == 1)
- What is printed? python print(max([]) if False else 'none', min([5, 2, 8]), sum([]), sum([[1], [2]], []))
- What is printed? python print(float('3.0') == 3, int(float('3.9')), round(3.5) + round(4.5), 3 == 3.0 == 3)