Quiz Space

Programming in Python End Term: 21 December 2025 (September 2025 term)

Question 1

+3 marksOne correct option

Consider the following functions: def p(n): if n < 10: return 1 return 1 + p(n // 10) def q(n): if n < 10: return n return n % 10 + q(n // 10) def r(n): if n <= 1: return 1 return n * r(n - 1) Which of the following function calls returns the number of digits in 50!, where n! is the factorial of n?

  1. A

    p(q(50))

  2. B

    q(r(50))

  3. C

    p(r(50))

  4. D

    r(q(50))

  5. E

    r(p(50))

Question 2

+3 marksOne correct option

Consider the following code snippet that writes student details to a CSV file named "employees.csv": def save_data(data): f = open('employees.csv', 'w') f.write('Name,Salary\n') for i in range(len(data)): emp, sal = data[i] row = f'{emp},{sal}' if i != len(data) - 1: row = row + '\n' f.write(row) f.close() data = [ ('Alice', 75000), ('Bob', 64000), ('Charlie', 82000), ('Diana', 71000), ('Eve', 69000) ] If the save_data(data) function is called with the list data as shown above, what will be the contents of the file "employees.csv"?

  1. A

    Name,Salary Alice,75000 Bob,64000 Charlie,82000 Diana,71000 Eve,69000

  2. B

    Alice,75000 Bob,64000 Charlie,82000 Diana,71000 Eve,69000

  3. C

    Salary,Name Alice,75000 Bob,64000 Charlie,82000 Diana,71000 Eve,69000

  4. D

    Name Salary Alice,75000 Bob,64000 Charlie,82000 Diana,71000 Eve,69000

  5. E

    Salary,Name 75000,Alice 64000,Bob 82000,Charlie 71000,Diana 69000,Eve

Question 3

+3 marksOne correct option

What will be the output of the following Python code? string1 = 'database' string2 = 'baseball' L = [] for i in range(len(string1)): for j in range(len(string2)): if string1[i] == string2[j]: L.append(string1[i]) break else: continue print(L)

  1. A

    ['a', 'a', 'b', 'a', 's', 'e']

  2. B

    ['a', 't', 'a', 'b', 'a', 's', 'e']

  3. C

    ['a', 'b', 'a', 's', 'e']

  4. D

    ['a', 'a', 'b', 's', 'e']

17 more questions in this paper

Sign in with Google — it is free — to see every question with its answer and explanation, practise it in learning mode, or take it as a timed mock test.

More on the Python End Term 21 Dec 2025 paper

The IIT Madras BS Programming in Python (Python) End Term paper sat on 21 Dec 2025, in the September 2025 term: 20 questions for 52 marks in 180 minutes. The first 3 questions are below. Sign in with Google — it is free — to see the whole paper with its answers and explanations, in learning mode or as a timed mock test.

FeaturePython End Term 21 Dec 2025 at a glance
TermSeptember 2025 term
SubjectProgramming in Python
Course codeBSCS1002
Questions20
Marks52
Duration180 min
MCQ8
MSQ3
Written9
Official paperIntro to Python 18 Dec 25
Negative markingNo negative marking.
Updated

Same End Term, other subjects

More Python