uiz Space

January 2026 term · Programming in Python · BSCS1002

Programming in Python End Term: 10 May 2026, Set 1 (January 2026 term)

The IIT Madras BS Programming in Python (Python) End Term paper sat on 10 May 2026, in the January 2026 term, set 1: 68 questions for 52 marks in 180 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.

Questions
68
Marks
52
Duration
180 min
MCQ
28
MSQ
12
Written
28

Updated

Official paper: Programming In Python 06 May 26 · No negative marking.

Question 1

+3 marksOne correct option

Consider the following recursive functions:

Which of the following function calls returns the last digit of 5! ?

Consider the following recursive functions:
  1. A

    —

  2. B

    —

  3. C

    —

  4. D

    —

Show answer

Correct answer

  • A

    —

Question 2

+4 marksOne correct option

Consider the following code snippet:

For what values as input the output generated by the above code snippet does not print A.

Consider the following code snippet:
  1. A

    x = 10 and y = 25

  2. B

    x = 6 and y = 20

  3. C

    x = 12 and y = 15

  4. D

    x = 15 and y = 16

Show answer

Correct answer

  • C

    x = 12 and y = 15

Question 3

+4 marksOne correct option

Consider the following code snippet:

For what values as input the output generated by the above code snippet does not print A.

Consider the following code snippet:
  1. A

    x = 10 and y = 25

  2. B

    x = 6 and y = 20

  3. C

    x = 12 and y = 15

  4. D

    x = 15 and y = 16

Show answer

Correct answer

  • C

    x = 12 and y = 15

Question 4

+3 marksOne correct option

Consider the following recursive functions:

Which of the following function calls returns the last digit of 5! ?

Consider the following recursive functions:
  1. A

    —

  2. B

    —

  3. C

    —

  4. D

    —

Show answer

Correct answer

  • A

    —

Question 5

+3 marksOne correct option

Consider the following class:

What are the values of , , and respectively?

Consider the following class:
  1. A

    1, False, 300

  2. B

    2, False, 500

  3. C

    2, True, 300

  4. D

    3, True, 300

Show answer

Correct answer

  • C

    2, True, 300

Question 6

+4 marksOne correct option

Which of the following code snippets print the first 100 powers of 3, one on each line. The line should have the value of . The output has 100 lines in total. The first five lines look like this:

Which of the following code snippets print the first 100 powers of 3, one on each line. The  line should have the value
  1. A
    Figure from the original question paper
  2. B
    Figure from the original question paper
  3. C
    Figure from the original question paper
  4. D
    Figure from the original question paper
Show answer

Correct answer

  • C
    Figure from the original question paper

Question 7

+4 marksOne correct option

Which of the following code snippets print the first 100 powers of 3, one on each line. The line should have the value of . The output has 100 lines in total. The first five lines look like this:

Which of the following code snippets print the first 100 powers of 3, one on each line. The  line should have the value
  1. A
    Figure from the original question paper
  2. B
    Figure from the original question paper
  3. C
    Figure from the original question paper
  4. D
    Figure from the original question paper
Show answer

Correct answer

  • C
    Figure from the original question paper

Question 8

+3 marksOne correct option

Consider the following class:

What are the values of , , and respectively?

Consider the following class:
  1. A

    1, False, 300

  2. B

    2, False, 500

  3. C

    2, True, 300

  4. D

    3, True, 300

Show answer

Correct answer

  • C

    2, True, 300

Question 9

+3 marksOne correct option

What will be the output of the following Python code?

What will be the output of the following Python code?
  1. A
    Figure from the original question paper
  2. B
    Figure from the original question paper
  3. C
    Figure from the original question paper
  4. D
    Figure from the original question paper
Show answer

Correct answer

  • A
    Figure from the original question paper

Question 10

+3 marksOne correct option

What will be the output of the following code snippet?

What will be the output of the following code snippet?
  1. A

    —

  2. B

    —

  3. C

    —

  4. D

    —

Show answer

Correct answer

  • B

    —

Question 11

+3 marksOne correct option

What will be the output of the following code snippet?

What will be the output of the following code snippet?
  1. A

    —

  2. B

    —

  3. C

    —

  4. D

    —

Show answer

Correct answer

  • B

    —

Question 12

+3 marksOne correct option

What will be the output of the following Python code?

What will be the output of the following Python code?
  1. A
    Figure from the original question paper
  2. B
    Figure from the original question paper
  3. C
    Figure from the original question paper
  4. D
    Figure from the original question paper
Show answer

Correct answer

  • A
    Figure from the original question paper

Question 13

+3 marksOne correct option

What is the output of the following snippet of code?

What is the output of the following snippet of code?
  1. A
    Figure from the original question paper
  2. B
    Figure from the original question paper
  3. C
    Figure from the original question paper
  4. D
    Figure from the original question paper
Show answer

Correct answer

  • B
    Figure from the original question paper

Question 14

+3 marksOne correct option

What is the output of the following code snippet? Assume the input is: abcd

What is the output of the following code snippet? Assume the input is: abcd
  1. A
    Figure from the original question paper
  2. B

    —

  3. C
    Figure from the original question paper
  4. D

    All snippets are wrong

Show answer

Correct answer

  • C
    Figure from the original question paper

Question 15

+3 marksOne correct option

What is the output of the following code snippet? Assume the input is: abcd

What is the output of the following code snippet? Assume the input is: abcd
  1. A
    Figure from the original question paper
  2. B

    —

  3. C
    Figure from the original question paper
  4. D

    All snippets are wrong

Show answer

Correct answer

  • C
    Figure from the original question paper

Question 16

+3 marksOne correct option

What is the output of the following snippet of code?

What is the output of the following snippet of code?
  1. A
    Figure from the original question paper
  2. B
    Figure from the original question paper
  3. C
    Figure from the original question paper
  4. D
    Figure from the original question paper
Show answer

Correct answer

  • B
    Figure from the original question paper

Question 17

+3 marksOne correct option

What is the output of the following code?

What is the output of the following code?
  1. A

    15

  2. B

    10

  3. C

    20

  4. D

    5

Show answer

Correct answer

  • A

    15

Question 18

+4 marksOne or more correct options

is a non-empty list of distinct integers that has already been defined. Which of the following statements are true at the end of execution of the code given below?

is a non-empty list of distinct integers that has already been defined. Which of the following statements are true at th

Select all that apply.

  1. A

    is always equal to , i.e., == returns the value True

  2. B

    is a list of integers sorted in ascending order.

  3. C

    is a list of integers sorted in descending order.

  4. D

    Every element in is present in , but not necessarily in the same sequence.

Show answer

Correct answers

  • B

    is a list of integers sorted in ascending order.

  • C

    is a list of integers sorted in descending order.

  • D

    Every element in is present in , but not necessarily in the same sequence.

Question 19

+4 marksOne or more correct options

is a non-empty list of distinct integers that has already been defined. Which of the following statements are true at the end of execution of the code given below?

is a non-empty list of distinct integers that has already been defined. Which of the following statements are true at th

Select all that apply.

  1. A

    is always equal to , i.e., == returns the value True

  2. B

    is a list of integers sorted in ascending order.

  3. C

    is a list of integers sorted in descending order.

  4. D

    Every element in is present in , but not necessarily in the same sequence.

Show answer

Correct answers

  • B

    is a list of integers sorted in ascending order.

  • C

    is a list of integers sorted in descending order.

  • D

    Every element in is present in , but not necessarily in the same sequence.

Question 20

+3 marksOne correct option

What is the output of the following code?

What is the output of the following code?
  1. A

    15

  2. B

    10

  3. C

    20

  4. D

    5

Show answer

Correct answer

  • A

    15

Question 21

+3 marksOne correct option

What is the output of the following snippet of code?

What is the output of the following snippet of code?
  1. A
    Figure from the original question paper
  2. B
    Figure from the original question paper
  3. C
    Figure from the original question paper
  4. D
    Figure from the original question paper
Show answer

Correct answer

  • B
    Figure from the original question paper

Question 22

+4 marksOne or more correct options

Consider the following code snippet.

Which of the following statements is/are correct?

Consider the following code snippet.

Select all that apply.

  1. A

    If the input is 45, then the output is

  2. B

    If the input is 80, then the output is

  3. C

    If the input is 5, then the output is

  4. D

    If the input is 25, then the output is

Show answer

Correct answers

  • B

    If the input is 80, then the output is

  • C

    If the input is 5, then the output is

  • D

    If the input is 25, then the output is

Question 23

+4 marksOne or more correct options

Consider the following code snippet.

Which of the following statements is/are correct?

Consider the following code snippet.

Select all that apply.

  1. A

    If the input is 45, then the output is

  2. B

    If the input is 80, then the output is

  3. C

    If the input is 5, then the output is

  4. D

    If the input is 25, then the output is

Show answer

Correct answers

  • B

    If the input is 80, then the output is

  • C

    If the input is 5, then the output is

  • D

    If the input is 25, then the output is

Question 24

+3 marksOne correct option

What is the output of the following snippet of code?

What is the output of the following snippet of code?
  1. A
    Figure from the original question paper
  2. B
    Figure from the original question paper
  3. C
    Figure from the original question paper
  4. D
    Figure from the original question paper
Show answer

Correct answer

  • B
    Figure from the original question paper

Question 25

+3 marksOne or more correct options

is a list of tuples. Each tuple is of the form . Select all snippets of code that create a list containing the names of products with price greater than 500. You can assume that is already defined. Sample Input

Sample Output

is a list of tuples. Each tuple is of the form  . Select all snippets of code that create a list  containing the names o
is a list of tuples. Each tuple is of the form  . Select all snippets of code that create a list  containing the names o

Select all that apply.

  1. A
    Figure from the original question paper
  2. B
    Figure from the original question paper
  3. C
    Figure from the original question paper
  4. D
    Figure from the original question paper
Show answer

Correct answers

  • A
    Figure from the original question paper
  • C
    Figure from the original question paper

Question 26

+4 marksOne or more correct options

Consider the following Python code:

Which of the following statements is/are true?

Consider the following Python code:

Select all that apply.

  1. A

    If x = 5 and y = 2, then output will be

  2. B

    If x = 4 and y = 8, then output will be

  3. C

    If x = 3 and y = 3, then output will be

  4. D

    If x = 10 and y = 5, then output will be

Show answer

Correct answers

  • A

    If x = 5 and y = 2, then output will be

  • B

    If x = 4 and y = 8, then output will be

Question 27

+4 marksOne or more correct options

Consider the following Python code:

Which of the following statements is/are true?

Consider the following Python code:

Select all that apply.

  1. A

    If x = 5 and y = 2, then output will be

  2. B

    If x = 4 and y = 8, then output will be

  3. C

    If x = 3 and y = 3, then output will be

  4. D

    If x = 10 and y = 5, then output will be

Show answer

Correct answers

  • A

    If x = 5 and y = 2, then output will be

  • B

    If x = 4 and y = 8, then output will be

Question 28

+3 marksOne or more correct options

is a list of tuples. Each tuple is of the form . Select all snippets of code that create a list containing the names of products with price greater than 500. You can assume that is already defined. Sample Input

Sample Output

is a list of tuples. Each tuple is of the form  . Select all snippets of code that create a list  containing the names o
is a list of tuples. Each tuple is of the form  . Select all snippets of code that create a list  containing the names o

Select all that apply.

  1. A
    Figure from the original question paper
  2. B
    Figure from the original question paper
  3. C
    Figure from the original question paper
  4. D
    Figure from the original question paper
Show answer

Correct answers

  • A
    Figure from the original question paper
  • C
    Figure from the original question paper

Question 29

+3 marksOne or more correct options

Consider the following class:

Which of the following statements are TRUE?

Consider the following class:

Select all that apply.

  1. A

    contains 2 entries

  2. B

    returns 87

  3. C

    is equal to

  4. D

    is True

  5. E

    is a string

Show answer

Correct answers

  • A

    contains 2 entries

  • B

    returns 87

  • D

    is True

Question 30

+4 marksWritten answer

Inscript What is the output of the following snippet of code?

Inscript What is the output of the following snippet of code?
Show answer

A written answer, not marked automatically.

Question 31

+4 marksWritten answer

Inscript What is the output of the following snippet of code?

Inscript What is the output of the following snippet of code?
Show answer

A written answer, not marked automatically.

Question 32

+3 marksOne or more correct options

Consider the following class:

Which of the following statements are TRUE?

Consider the following class:

Select all that apply.

  1. A

    contains 2 entries

  2. B

    returns 87

  3. C

    is equal to

  4. D

    is True

  5. E

    is a string

Show answer

Correct answers

  • A

    contains 2 entries

  • B

    returns 87

  • D

    is True

Question 33

+3 marksOne or more correct options

Consider the following snippet of code:

Select all that apply. Note If a value is passed to , it reads that many number of characters from • the current position of the file pointer. The method moves the position of the file pointer to the given number of chars after the start of the file. •

Consider the following snippet of code:

Select all that apply.

  1. A

    The first line of the output is .

  2. B

    The second line of the output is .

  3. C

    The second line of the output is .

  4. D

    There are 5 lines in the output.

  5. E

    The output contains empty lines.

Show answer

Correct answers

  • A

    The first line of the output is .

  • C

    The second line of the output is .

  • D

    There are 5 lines in the output.

Question 34

+4 marksWritten answer

What is the output of the following snippet of code?

What is the output of the following snippet of code?
Show answer

A written answer, not marked automatically.

Question 35

+4 marksWritten answer

What is the output of the following snippet of code?

What is the output of the following snippet of code?
Show answer

A written answer, not marked automatically.

Question 36

+3 marksOne or more correct options

Consider the following snippet of code:

Select all that apply. Note If a value is passed to , it reads that many number of characters from • the current position of the file pointer. The method moves the position of the file pointer to the given number of chars after the start of the file. •

Consider the following snippet of code:

Select all that apply.

  1. A

    The first line of the output is .

  2. B

    The second line of the output is .

  3. C

    The second line of the output is .

  4. D

    There are 5 lines in the output.

  5. E

    The output contains empty lines.

Show answer

Correct answers

  • A

    The first line of the output is .

  • C

    The second line of the output is .

  • D

    There are 5 lines in the output.

Question 37

+3 marksWritten answer

Consider the following Python code snippet:

What is the output of the program?

Consider the following Python code snippet:
Show answer

A written answer, not marked automatically.

Question 38

+4 marksWritten answer

What is the output of the following snippet of code?

What is the output of the following snippet of code?
Show answer

A written answer, not marked automatically.

Question 39

+4 marksWritten answer

What is the output of the following snippet of code?

What is the output of the following snippet of code?
Show answer

A written answer, not marked automatically.

Question 40

+3 marksWritten answer

Consider the following Python code snippet:

What is the output of the program?

Consider the following Python code snippet:
Show answer

A written answer, not marked automatically.

Question 41

+3 marksWritten answer

What is printed?

What is printed?
Show answer

A written answer, not marked automatically.

Question 42

+4 marksWritten answer

Consider the following snippet of code. What will the output be?

Consider the following snippet of code. What will the output be?
Show answer

A written answer, not marked automatically.

Question 43

+4 marksWritten answer

Consider the following snippet of code. What will the output be?

Consider the following snippet of code. What will the output be?
Show answer

A written answer, not marked automatically.

Question 44

+3 marksWritten answer

What is printed?

What is printed?
Show answer

A written answer, not marked automatically.

Question 45

+3 marksWritten answer

What is the output of the following snippet?

What is the output of the following snippet?
Show answer

A written answer, not marked automatically.

Question 46

+4 marksOne correct option

Consider the following snippet of code and answer all the given subquestions:

Consider the following snippet of code and answer all the given subquestions:

What is the first line of the output?

  1. A

    10

  2. B

    14

  3. C

    6

  4. D

    18

Show answer

Correct answer

  • B

    14

Question 47

+4 marksOne correct option

Consider the following snippet of code and answer all the given subquestions:

Consider the following snippet of code and answer all the given subquestions:

What is the first line of the output?

  1. A

    10

  2. B

    14

  3. C

    6

  4. D

    18

Show answer

Correct answer

  • B

    14

Question 48

+3 marksWritten answer

What is the output of the following snippet?

What is the output of the following snippet?
Show answer

A written answer, not marked automatically.

Question 49

+3 marksWritten answer

What is the output?

What is the output?
Show answer

A written answer, not marked automatically.

Question 50

+4 marksOne correct option

Consider the following snippet of code and answer all the given subquestions:

Consider the following snippet of code and answer all the given subquestions:

What is the second line of the output?

  1. A

    6

  2. B

    162

  3. C

    36

  4. D

    48

Show answer

Correct answer

  • B

    162

Question 51

+4 marksOne correct option

Consider the following snippet of code and answer all the given subquestions:

Consider the following snippet of code and answer all the given subquestions:

What is the second line of the output?

  1. A

    6

  2. B

    162

  3. C

    36

  4. D

    48

Show answer

Correct answer

  • B

    162

Question 52

+3 marksWritten answer

What is the output?

What is the output?
Show answer

A written answer, not marked automatically.

Question 53

+3 marksWritten answer

What is the output of the following code?

What is the output of the following code?
Show answer

A written answer, not marked automatically.

Question 54

+3 marksWritten answer

What is the output of the following code?

What is the output of the following code?
Show answer

A written answer, not marked automatically.

Question 55

+2 marksOne correct option

Based on the above program, answer the given subquestions.

Based on the above program, answer the given subquestions.

What does the first statement output?

  1. A

    97

  2. B

    93

  3. C

    288

  4. D

    98

Show answer

Correct answer

  • C

    288

Question 56

+2 marksOne correct option

Based on the above program, answer the given subquestions.

Based on the above program, answer the given subquestions.

What does the first statement output?

  1. A

    97

  2. B

    93

  3. C

    288

  4. D

    98

Show answer

Correct answer

  • C

    288

Question 57

+2 marksOne correct option

Based on the above program, answer the given subquestions.

Based on the above program, answer the given subquestions.

What is printed in the second line?

  1. A

    P

  2. B

    C

  3. C

    B

  4. D

    None

Show answer

Correct answer

  • C

    B

Question 58

+2 marksOne correct option

Based on the above program, answer the given subquestions.

Based on the above program, answer the given subquestions.

What is printed in the second line?

  1. A

    P

  2. B

    C

  3. C

    B

  4. D

    None

Show answer

Correct answer

  • C

    B

Question 59

+2 marksWritten answer

Based on the above program, answer the given subquestions.

Based on the above program, answer the given subquestions.

What is the element at position [0][2] in ?

Show answer

A written answer, not marked automatically.

Question 60

+2 marksWritten answer

Based on the above program, answer the given subquestions.

Based on the above program, answer the given subquestions.

What is the element at position [0][2] in ?

Show answer

A written answer, not marked automatically.

Question 61

+2 marksWritten answer

Based on the above program, answer the given subquestions.

Based on the above program, answer the given subquestions.

What is the value of the second line of output?

Show answer

A written answer, not marked automatically.

Question 62

+2 marksWritten answer

Based on the above program, answer the given subquestions.

Based on the above program, answer the given subquestions.

What is the value of the second line of output?

Show answer

A written answer, not marked automatically.

Question 63

+1 markWritten answer

Based on the above program, answer the given subquestions.

Based on the above program, answer the given subquestions.
Show answer

A written answer, not marked automatically.

Question 64

+1 markWritten answer

Based on the above program, answer the given subquestions.

Based on the above program, answer the given subquestions.
Show answer

A written answer, not marked automatically.

Question 65

+1 markWritten answer

Consider the following snippet of code and answer all the given subquestions:

Consider the following snippet of code and answer all the given subquestions:
Show answer

A written answer, not marked automatically.

Question 66

+1 markWritten answer

Consider the following snippet of code and answer all the given subquestions:

Consider the following snippet of code and answer all the given subquestions:
Show answer

A written answer, not marked automatically.

Question 67

+1 markWritten answer

Based on the above program, answer the given subquestions.

Based on the above program, answer the given subquestions.
Show answer

A written answer, not marked automatically.

Question 68

+1 markWritten answer

Based on the above program, answer the given subquestions.

Based on the above program, answer the given subquestions.
Show answer

A written answer, not marked automatically.