ProgrammingHardTCS NQT · Infosys
What is printed?
What is printed?
print(1 + '1' if False else '1' + str(1), '3' * 2 + str(4 - 1), int('3' * 2) + 4 - 1)- A. 11 33 36
- B. 11 333 35
- C. 11 333 36
- D. 11 333 37
Correct answer: C. 11 333 36
The conditional expression is False, so the first value is '1' + str(1), which is 11. '3' * 2 is 33 and str(3) makes 333, while int('33') + 4 - 1 is 36.
More Python Programming questions
- What is printed? python print(bool(0 or '' or []), bool([[]]), bool([0]), bool(' '.strip()))
- What is printed? python print(round(2.345, 2), round(2.355, 2), round(7.5), round(8.5))
- What is printed? python print(len([x for x in range(3) for y in range(x)]), [x y for x in range(3) for y in (1, 2) if x], sum(1 for i in…
- What is printed? python data = {'a': 1} print(data.get('b', 0) + 1, data.get('a') + 1, 'a' in data, 1 in data.values())
- What is printed? python print(3 in range(5), 5 in range(5), range(0, 6, 2) == range(0, 7, 2), list(range(3, 0, -1)))
- What is printed? python print(10 % 4 == 2, -10 % 4 == 2, 10 // -4, 10 / -4)