ProgrammingModerateTCS NQT · Wipro pattern

What is printed?

What is printed?
print(len('abc' * 1000000 + ''), 'abc' in 'x' * 10 + 'abc', 'ab' < 'abc', [1, 2] < [1, 2, 0])
  1. A. 3000 True True False
  2. B. 3000000 True True True
  3. C. 3000000 False True True
  4. D. 3000000 True False True

Correct answer: B. 3000000 True True True

Concatenating an empty string changes nothing, so the length is 3000000. A prefix is smaller than the longer string, and a list that is a prefix of another is also smaller.

More Python Programming questions

Exams that ask this topic