Mumbai University Solved Question Papers munotes.in
Introduction to Programming with Python
BSc CS · Sem 1
Nov 2023 Examination
Previous Year Question Paper with Solution
munotes.in Mumbai
Mumbai University Solved Question Papers munotes.in
Introduction to Programming with Python
BSc CS · Sem 1
Nov 2023 Examination
Previous Year Question Paper with Solution
munotes.in Mumbai
First published on munotes.in on 12 November 2026.
Published by munotes.in, Mumbai.
Model answers written and edited by the munotes.in editorial desk.
Passages from this volume may be quoted, in print, online or by an AI system, with credit: name munotes.in and link to this volume's page. The volume may not be reproduced as a whole. Full terms at munotes.in/content-license.
munotes.in is an independent study resource for students of the University of Mumbai. It is not affiliated with the University of Mumbai, and is not endorsed by it.
The University does not publish an official answer key for this paper. The answers in this volume are model answers, written to show how a full-mark answer is built. They are a study aid, not an authority on what an examiner marked.
The question paper reproduced here is the paper as set by the University of Mumbai at the Nov 2023 examination.
The questions below are the paper as the University of Mumbai set it at the Nov 2023 examination, in the order it was set.
MarksPage
MarksPage
The questions in this volume are the questions asked at the Nov 2023 examination, reproduced as the University of Mumbai set them, in the order it set them. Nothing has been reworded, added or left out. Only the answers are ours. See the original question paper.
Duration 2½ hours · Total marks 75 · 24 questions answered
How to use this volume
Solve the paper first, under exam conditions and against the clock. Then read the answers here and mark your own. Reading a solution before attempting the question feels productive and teaches very little, because recognising an answer is not the same as being able to write one.
Q1) Attempt any four: 20 Marks
Answer
For full marks, cover: the definition of a lambda function; its syntax; a program with output; how a lambda differs from a def function; where lambdas are used (sort keys, filter, map); its limits.
A lambda function is a small function with no name, written in one line with the keyword lambda. It is also called an anonymous function. It can take any number of arguments, but its body is a single expression. The value of that expression is returned automatically.
lambda arguments: expression
The arguments come before the colon and the expression after it. There is no return keyword, because the expression itself is the result. A lambda is usually assigned to a name or passed straight to another function.
square = lambda x: x * xadd = lambda a, b: a + bprint(square(6), add(3, 4))marks = [("Asha", 72), ("Ravi", 58), ("Meera", 91)]marks.sort(key=lambda s: s[1])print(marks)nums = [1, 2, 3, 4, 5, 6]print(list(filter(lambda n: n % 2 == 0, nums)))print(list(map(lambda n: n * 10, nums)))Output:
36 7[('Ravi', 58), ('Asha', 72), ('Meera', 91)][2, 4, 6][10, 20, 30, 40, 50, 60]
square takes one argument and returns its square, so square(6) is 36. add takes two arguments and returns 7.filter() keeps the items for which the lambda gives True, which are the even numbers.map() applies the lambda to every item, so each number is multiplied by 10.| Point | lambda | def |
|---|---|---|
| Name | none, unless assigned | always named |
| Body | one expression | any number of statements |
| return | automatic | written with return |
| Typical use | a short function used once | a function used many times |
A lambda cannot hold statements such as if blocks, loops or assignments. It may use a conditional expression, for example lambda n: "even" if n % 2 == 0 else "odd". Anything longer should be written with def, because it is easier to read and test.
Conclusion. A lambda function is an anonymous one-expression function written as lambda arguments: expression. It returns its expression's value, and it is most useful as a short key or rule passed to sort(), filter() or map().
The rest of the answers
You have read the question paper and its first answer in full. Buy the solved papers once and you can read every answer of every solved paper in this semester.
Notes + practical solutions + solved papers: ₹798 Already bought it? Sign in
Or solved papers only: ₹499
Or notes + practical solutions: ₹499
The question paper itself stays free, and so does the syllabus.
What should we fix or add?
Found an error in this volume? Report it and we will check it against the paper.