ProgrammingModerateTCS NQT · Wipro pattern

What is printed?

What is printed?
print(int('3' * 3) + int('4' * 2) * 2, '3' * 3 + '4' * 2 * 2)
  1. A. 421 33344
  2. B. 331 3334444
  3. C. 422 3334444
  4. D. 421 3334444

Correct answer: D. 421 3334444

Multiplication binds tighter than +, so the number part is 333 + 44 * 2 = 421. For strings, '4' * 2 * 2 is '4444', so the concatenation is '333' followed by '4444'.

More Python Programming questions

Exams that ask this topic