uiz Space

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

Programming, Data Structures and Algorithms using Python End Term: 10 May 2026, Set 1-2 (January 2026 term)

The IIT Madras BS Programming, Data Structures and Algorithms using Python (PDSA) End Term paper sat on 10 May 2026, in the January 2026 term, set 1-2: 24 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
24
Marks
100
Duration
180 min
Numerical
7
MCQ
15
MSQ
2

Updated

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

Question 1

+4 marksNumerical answer

Consider the following function:

Show answer

Correct answer: 6

Question 2

+4 marksNumerical answer

In a binary tree, the total number of nodes is 28. It is known that 10 nodes have exactly two children.
How many nodes have exactly one child?

Show answer

Correct answer: 7

Question 3

+4 marksNumerical answer

While inserting the elements 60, 30, 50, 55, 80, 90, 65, 70, and 10 into an empty binary search tree (BST) in the sequence shown, the sum of elements at maximum depth is __.

Show answer

Correct answer: 125

Question 4

+4 marksNumerical answer

How many bits will be used to encode the message ABCDE using Huffman codes?

Show answer

Correct answer: 13

Question 5

+4 marksNumerical answer
Show answer

Correct answer: 9

Question 6

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

Correct answer

  • D

Question 7

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

Correct answer

  • B

Question 8

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

Correct answer

  • B

Question 9

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

Correct answer

  • B

Question 10

+4 marksOne correct option

Run BFS starting from vertex A. If multiple adjacent vertices exist, they are visited in alphabetical order.
Which of the following is the correct BFS traversal order?

  1. A

    A, B, D, E, C, F, G, H, I, J

  2. B

    A, B, D, E, F, C, G, H, I, J

  3. C

    A, B, C, H, J, G, D, E, F, I

  4. D

    A, B, D, E, C, F, H, G, I, J

Show answer

Correct answer

  • A

    A, B, D, E, C, F, G, H, I, J

Question 11

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

Correct answer

  • A

Question 12

+4 marksOne correct option

The Bellman-Ford algorithm cannot be used if a graph has negative cycles. This is because:

  1. A

    The algorithm only runs for n iterations, where n is the number of vertices.

  2. B

    The notion of the shortest path is not well-defined if there are negative cycles.

  3. C

    Dealing with negative cycles requires examining all paths exhaustively, which takes exponential time.

  4. D

    To handle negative cycles, we need to compute all-pairs shortest paths.

Show answer

Correct answer

  • B

    The notion of the shortest path is not well-defined if there are negative cycles.

Question 13

+4 marksOne correct option

While inserting the elements 8, 4, 1, 3, 9, 2, and 11 in an empty AVL tree in the given sequence, the leaf elements are__.

  1. A

    1, 3, 8, 11

  2. B

    1, 3, 9, 11

  3. C

    2, 3, 9, 11

  4. D

    1, 2, 8, 11

Show answer

Correct answer

  • A

    1, 3, 8, 11

Question 14

+4 marksOne correct option
  1. A

    2

  2. B

    3

  3. C

    4

  4. D

    5

Show answer

Correct answer

  • C

    4

Question 15

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

Correct answer

  • C

Question 16

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

Correct answer

  • D

Question 17

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

Correct answer

  • C

Question 18

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

Correct answer

  • A

Question 19

+4 marksOne correct option

Let G be a simple graph with 25 vertices and 50 edges. The size of the minimum vertex cover of G is 10. What is the size of the maximum independent set of G ?

  1. A

    65

  2. B

    90

  3. C

    15

  4. D

    35

Show answer

Correct answer

  • C

    15

Question 20

+5 marksOne or more correct options

Which of the following could be possible insertion orders that produce this table?

Select all that apply.

  1. A

    21, 32, 27, 12, 31, 40, 25

  2. B

    21, 32, 27, 12, 25, 31, 40

  3. C

    40, 32, 21, 25, 31, 12, 17

  4. D

    40, 32, 21, 25, 31, 27, 12

Show answer

Correct answers

  • A

    21, 32, 27, 12, 31, 40, 25

  • D

    40, 32, 21, 25, 31, 27, 12

Question 21

+5 marksNumerical answer

A technology training institute offers an advanced certification program consisting of 10 modules. The program is divided into terms of 4 months.
Students may enroll in any number of modules in a term, but a module can only be taken after completing all of its prerequisite modules.
The prerequisite structure is given below.

There is no restriction on the number of modules a student can take in a term.
The minimum number of terms required to complete all 10 modules is ___.

Show answer

Correct answer: 6

Question 22

+5 marksNumerical answer
Show answer

Correct answer: 26

Question 23

+5 marksOne correct option

Consider the following graph.

Which of the following options correctly represents the shortest distances from node 0 to nodes (1, 2, 3, 4, 5) respectively?

  1. A

    3, 2, 5, 9, 8

  2. B

    4, 2, 6, 9, 8

  3. C

    3, 2, 5, 8, 7

  4. D

    3, 2, 5, 7, 8

Show answer

Correct answer

  • C

    3, 2, 5, 8, 7

Question 24

+4 marksOne or more correct options

Consider the graph G given below.

Let Minimum Spanning Trees (MSTs) of the graph be constructed using algorithms such as Kruskal’s or Prim’s algorithm.
Which of the following statement(s) is/are correct?

Select all that apply.

  1. A

    The total weight of every MST is 10

  2. B

    The total weight of every MST is 11

  3. C

    The edge (d, e) will not be part of any MST

  4. D

    The edge (b, e) will be part of every MST

  5. E

    The number of distinct MSTs in the graph is 2

Show answer

Correct answers

  • A

    The total weight of every MST is 10

  • C

    The edge (d, e) will not be part of any MST

  • D

    The edge (b, e) will be part of every MST