uiz Space

May 2026 term · Programming, Data Structures and Algorithms using Python · BSCS2002

Programming, Data Structures and Algorithms using Python End Term: 13 September 2026 (May 2026 term)

The IIT Madras BS Programming, Data Structures and Algorithms using Python (PDSA) End Term paper sat on 13 Sept 2026, in the May 2026 term: 25 questions for 100 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
25
Marks
100
Duration
180 min
Numerical
8
MCQ
12
MSQ
5

Updated

Official paper: Programming, Data Structures And Algorithms Using Python 13 Sep 26 · No negative marking.

Question 1

+4 marksNumerical answer

What does the function f(1000,2) return?

Show answer

Correct answer: 10

Question 2

+4 marksNumerical answer

Consider the following implementation for Queue

Show answer

Correct answer: 31

Question 3

+4 marksNumerical answer

What is the total weight of the Minimum Spanning Tree (MST) of this graph?

Show answer

Correct answer: 12

Question 4

+4 marksNumerical answer
Show answer

Correct answer: 15

Question 5

+4 marksNumerical answer
Show answer

Correct answer: 7

Question 6

+4 marksNumerical answer
Show answer

Correct answer: 12

Question 7

+4 marksNumerical answer

Inscript Consider the following grid.

Show answer

Correct answer: 18

Question 8

+4 marksNumerical answer
Show answer

Correct answer: 17

Question 9

+4 marksOne correct option
  1. A

    (i), (ii) and (iii) are all not true.

  2. B

    (ii) and (iii) are true but (i) is not true.

  3. C

    (ii) is true but (i) and (iii) are not true.

  4. D

    (i) and (ii) are true but (iii) is not true.

Show answer

Correct answer

  • B

    (ii) and (iii) are true but (i) is not true.

Question 10

+4 marksOne correct option
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • D

Question 11

+4 marksOne correct option
  1. A

    Index 0: 35, Index 1: 21, Index 2: 14

  2. B

    Index 0: 14, Index 1: 21, Index 2: 35

  3. C

    Index 0: 14, Index 1: 21, Index 4: 35

  4. D

    Index 0: 14, Index 4: 21, Index 1: 35

Show answer

Correct answer

  • C

    Index 0: 14, Index 1: 21, Index 4: 35

Question 12

+4 marksOne correct option
  1. A
  2. B
  3. C
  4. D

    Graph G cannot exist because a vertex of degree 5 must be adjacent to every other vertex, which contradicts the presence of a vertex of degree 0.

Show answer

Correct answer

  • D

    Graph G cannot exist because a vertex of degree 5 must be adjacent to every other vertex, which contradicts the presence of a vertex of degree 0.

Question 13

+4 marksOne correct option

Suppose we run the Bellman-Ford algorithm on a directed graph where every edge weight is strictly positive. Which of the following statements accurately describes the behavior of the algorithm?

  1. A

    The algorithm will produce incorrect results because it is exclusively designed to process negative edge weights.

  2. B

    The algorithm will correctly find the shortest paths; however, its worst-case time complexity is higher than that of Dijkstra's algorithm for graphs with non-negative edge weights.

  3. C

    The algorithm will terminate early after exactly 1 iteration because positive edge graphs do not require path relaxation.

  4. D

    The algorithm will flag the graph as containing a negative cycle because it expects at least one negative edge value.

Show answer

Correct answer

  • B

    The algorithm will correctly find the shortest paths; however, its worst-case time complexity is higher than that of Dijkstra's algorithm for graphs with non-negative edge weights.

Question 14

+4 marksOne correct option
  1. A

    24

  2. B

    49

  3. C

    50

  4. D

    51

Show answer

Correct answer

  • B

    49

Question 15

+4 marksOne correct option
  1. A

    [5, 10, 15, 25, 50, 30, 40, 12]

  2. B

    [5, 25, 10, 40, 50, 30, 15, 12]

  3. C

    [5, 10, 15, 40, 50, 30, 12, 25]

  4. D

    [5, 10, 12, 25, 50, 30, 15, 40]

Show answer

Correct answer

  • D

    [5, 10, 12, 25, 50, 30, 15, 40]

Question 16

+4 marksOne correct option

Suppose the letters {A, B, C, D, E} occur with the following frequencies.

How many bits will be used to encode the letter E in the Huffman code for this alphabet?

  1. A

    1

  2. B

    2

  3. C

    3

  4. D

    4

Show answer

Correct answer

  • C

    3

Question 17

+4 marksOne correct option
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • B

Question 18

+4 marksOne correct option

Consider the following function:

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • B

Question 19

+4 marksOne correct option
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • C

Question 20

+4 marksOne correct option

Which of the following statements provides the most accurate definition of the complexity class NP?

  1. A

    It is the class of decision problems that can be solved by a deterministic algorithm in polynomial time.

  2. B

    It is the class of decision problems for which a proposed solution can be verified by a deterministic algorithm in polynomial time.

  3. C

    It is the class of complex problems that can never be solved in polynomial time under any circumstances.

  4. D

    It is the class of optimization problems that can only be solved using a non- polynomial greedy strategy.

Show answer

Correct answer

  • B

    It is the class of decision problems for which a proposed solution can be verified by a deterministic algorithm in polynomial time.

Question 21

+4 marksOne or more correct options

Which of the following statements is/are true about quicksort?

Select all that apply.

  1. A
  2. B
  3. C

    Quicksort and merge sort are both examples of divide and conquer algorithms.

  4. D
  5. E

    The standard in-place implementation of quicksort preserves the relative order of equal elements, making it a stable sorting algorithm.

Show answer

Correct answers

  • A
  • B
  • C

    Quicksort and merge sort are both examples of divide and conquer algorithms.

Question 22

+4 marksOne or more correct options

Let G be a simple, undirected graph with n = 10 vertices. If G is disconnected, which of the following could be the total number of edges (e) in G? (Select all that apply)

Select all that apply.

  1. A

    45

  2. B

    37

  3. C

    36

  4. D

    35

  5. E

    33

Show answer

Correct answers

  • C

    36

  • D

    35

  • E

    33

Question 23

+4 marksOne or more correct options

Which of the following edges cannot be present in the original graph? (Select all that apply)

Select all that apply.

  1. A
  2. B
  3. C
  4. D
  5. E
Show answer

Correct answers

  • B
  • C
  • D

Question 24

+4 marksOne or more correct options

Select all that apply.

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answers

  • A
  • C

Question 25

+4 marksOne or more correct options

Select all that apply.

  1. A

    (1, 3)

  2. B

    (5, 1)

  3. C

    (4, 2)

  4. D

    (3, 4)

  5. E

    (3, 2)

Show answer

Correct answers

  • B

    (5, 1)

  • C

    (4, 2)

  • E

    (3, 2)