ProgrammingHardTCS NQT · Wipro pattern

What is printed?

What is printed?
print(list(map(int, '1 2 3'.split())), list(map(str.upper, 'ab')), sum(map(int, '9' * 3)) % 7)
  1. A. [1, 2, 3] ['a', 'c'] 6
  2. B. [1, 2, 3] ['A', 'B'] 5
  3. C. [1, 2] ['A', 'B'] 6
  4. D. [1, 2, 3] ['A', 'B'] 6

Correct answer: D. [1, 2, 3] ['A', 'B'] 6

Each map applies the function to every item, and the digits 9 + 9 + 9 total 27, which is 6 mod 7.

More Python Programming questions

Exams that ask this topic