Indian Institute of Technology Madras
BS Degree Programme · Examination & Study Paper
Programming in Python
Comprehensions, map & lambda
Official Paper
Examination Instructions & Guidelines
- Solve on notebook/paper first before checking solutions.
- MCQ: Exactly 1 option is correct. Negative marking applies.
- MSQ: One or more options correct. Select all to score.
- Scientific calculator allowed for all calculations.
- Official answer key is sealed at the end of this sheet.
End Term · 31 Aug 2025 (FN)End Term
- Q1MSQ3 Marks·Choose all correct options
Consider the use of the _(map()) function in the following code snippets. Select all options that has the value _([4, 9, 16, 25]) in the variable _(squares) after execution.
- Anums = [2, 3, 4, 5] squares = list(map(lambda x: x**2, nums))
- Bnums = [4, 9, 16, 25] squares = map(int, nums)
- Cnums = [2, 3, 4, 5] def square(n): return n * n squares = list(map(square, nums))
- Dnums = [2, 3, 4, 5] squares = [] for x in nums: squares.append(x ** 2)
- Enums = [2, 3, 4, 5] squares = list(map(pow, nums, [2]*4))
End Term · 31 Aug 2025 (AN)End Term
- Q2MCQ3 Marks·Choose one option
Consider the below output. 1 4 7 2 5 8 3 6 9 Select the code snippet that will generate the above output.
- Amatrix = [[i + (j+1)*3 for i in range(3)] for j in range(3)] for row in matrix: print(*row)
- Bmatrix = [[(i+1) + j*3 for i in range(3)] for j in range(3)] for row in matrix: print(*row)
- Cmatrix = [[(j+1) + i*3 for j in range(3)] for i in range(3)] for row in matrix: print(*row)
- Dmatrix = [[(i+1) + j*3 for j in range(3)] for i in range(3)] for row in matrix: print(*row)
End Term · 13 Apr 2025 (FN)End Term
- Q3MSQ3 Marks·Choose all correct options

- A

- B

- C

- D

- A
End Term · 13 Apr 2025 (AN)End Term
- Q4MSQ3 Marks·Choose all correct options

- A

- B

- C

- D

- A
End Term · 22 Dec 2024 (FN)End Term
- Q5MSQ3 Marks·Choose all correct options

- A

- B

- C

- D

- E

- A
End Term · 22 Dec 2024 (AN)End Term
- Q6MSQ3 Marks·Choose all correct options

- A

- B

- C

- D

- E

- A