ProgrammingModerateTCS NQT · Infosys
What is printed?
What is printed?
print(str(3) * 2 + str(3 * 2), int(str(3) * 2) + 3 * 2)
- A. 336 36
- B. 333 39
- C. 66 39
- D. 336 39
Correct answer: D. 336 39
str(3) * 2 is '33' and str(6) is '6', so the text is '336'. int('33') + 6 is 39, which is a number, not text.
More Python Programming questions
- What is printed? python print(10 // 3 3 + 10 % 3 == 10, -10 // 3 3 + -10 % 3 == -10)
- What is printed? python print(sum(int(d) for d in str(320)) % 9, 320 % 9, (320) % 10)
- What is printed? python print(len(str(1050 + 1).rstrip('0')), str(1050 + 1)[-2:], str(1050 - 1)[:3])
- What is printed? python print(max(map(len, ['abc', 'de', 'fghi'])), list(map(len, ['abc', '', 'x'])), sum(map(len, ['ab', 'cd'])))
- What is printed? python print(float('1e-3') 1000 == 1, int(float('1e-3') 1000), round(float('1e-3') 1000))
- What is printed? python print(len({'a': 1, 'b': 2}), len({'a', 'a', 'b'}), len(dict.fromkeys('hello')))