ProgrammingModerateTCS NQT · Accenture

What is printed?

What is printed?
print(repr('ab' * -1), [1] * 0, 'a' * 3 == 'aaa')
  1. A. 'ab' [] True
  2. B. '' [] True
  3. C. '' [1] True
  4. D. '' [] False

Correct answer: B. '' [] True

Multiplying by a negative count gives an empty sequence, and multiplying by zero also gives an empty list. 'a' * 3 equals 'aaa'.

More Python Programming questions

Exams that ask this topic