ProgrammingModerateTCS NQT · Infosys
What is printed?
What is printed?
print(int('12' * 2) + int('3' * 2), len({'x' * n for n in range(4)}))- A. 1245 3
- B. 1215 4
- C. 1245 4
- D. 1245 5
Correct answer: C. 1245 4
int('1212') + int('33') is 1212 + 33 = 1245. The set has four distinct strings, from the empty string up to 'xxx'.
More Python Programming questions
- What is printed? python print(bin(6 & -6), bin(6 | -6), bin(6 ^ -6))
- What is printed? python print(hex(28 - 1), oct(29), bin(24))
- What is printed? python print(str(0.5), str(0.25 + 0.125), 0.1 + 0.25)
- What is printed? python s = 'a,b;c' print(s.split(',;'), s.replace(';', ','), s.split(';'))
- What is printed? python print(max(range(5), key=lambda i: (i % 3, -i)))
- What is printed? python print(sum(x x for x in range(-3, 4)), sum(abs(x) for x in range(-3, 4)))