Indian Institute of Technology Madras
BS Degree Programme · Examination & Study Paper
Programming, Data Structures and Algorithms using Python
Most repeated questions
Examination Instructions & Guidelines
- Solve on notebook/paper first before checking solutions.
- MCQ: Exactly 1 option is correct. Negative marking applies.
- MSQ: One or more options correct. Select all to score.
- NAT: Numerical response. No negative marking.
- Scientific calculator allowed for all calculations.
- Official answer key is sealed at the end of this sheet.
Type 1 · asked 6 times · Graphs, BFS, DFS & topological sort
Use n(n-1) or n(n-1)/2 to relate edges and vertices of a graph
- Q1NAT4 Marks·Write the numberEnd Term · 22 Dec 2024 (AN)Key ↓
Your answer: - Q2NAT4 Marks·Write the numberEnd Term · 22 Dec 2024 (FN)Key ↓
Your answer: - Q3MCQ4 Marks·Choose one optionEnd Term · 13 Apr 2025 (AN)Key ↓

- A

- B

- C

- D

- A
- Q4NAT4 Marks·Write the numberEnd Term · 31 Aug 2025 (AN)Key ↓
What is the maximum number of edges in a directed graph with 9 vertices?
Your answer: - Q5NAT4 Marks·Write the numberEnd Term · 31 Aug 2025 (FN)Key ↓
An undirected graph has 300 edges. What is the minimum number of vertices it must have?
Your answer: - Q6NAT3 Marks·Write the numberQuiz 1 · 26 Oct 2025 (AN)Key ↓
Your answer:
Type 2 · asked 6 times · Greedy: scheduling, Huffman, merging
Build a Huffman tree and find code lengths or total bits
- Q7NAT4 Marks·Write the numberEnd Term · 22 Dec 2024 (AN)Key ↓
Your answer: - Q8MCQ4 Marks·Choose one optionEnd Term · 22 Dec 2024 (FN)Key ↓

- A1
- B2
- C3
- D4
- Q9MCQ4 Marks·Choose one optionEnd Term · 13 Apr 2025 (AN)Key ↓

- A1
- B2
- C3
- D4
- Q10MCQ3 Marks·Choose one optionQuiz 2 · 3 Aug 2025 (AN)Key ↓

- A328
- B82
- C100
- D126
- Q11MCQ4 Marks·Choose one optionEnd Term · 31 Aug 2025 (AN)Key ↓

- A

- B

- C

- D

- A
- Q12MCQ4 Marks·Choose one optionEnd Term · 31 Aug 2025 (FN)Key ↓

- A

- B

- C

- D

- A
Type 3 · asked 5 times · Shortest paths: Dijkstra & Bellman-Ford
Run Dijkstra's algorithm and find visit order or shortest distances
- Q13MCQ4 Marks·Choose one optionEnd Term · 22 Dec 2024 (AN)Key ↓

- A

- B

- C

- D

- A
- Q14MCQ4 Marks·Choose one optionEnd Term · 22 Dec 2024 (FN)Key ↓

- A

- B

- C

- D

- A
- Q15NAT4 Marks·Write the numberEnd Term · 13 Apr 2025 (AN)Key ↓
Your answer: - Q16MCQ4 Marks·Choose one optionQuiz 2 · 3 Aug 2025 (AN)Key ↓

- A

- B

- C

- D

- A
- Q17NAT4 Marks·Write the numberEnd Term · 31 Aug 2025 (FN)Key ↓
Your answer:
Type 4 · asked 5 times · Linear programming & network flow
Pick valid or invalid constraints for a word-problem LP
- Q18MSQ4 Marks·Choose all correct optionsEnd Term · 22 Dec 2024 (AN)Key ↓

- A

- B

- C

- D

- A
- Q19MCQ4 Marks·Choose one optionEnd Term · 22 Dec 2024 (FN)Key ↓

- A

- B

- C

- D

- A
- Q20MSQ4 Marks·Choose all correct optionsEnd Term · 13 Apr 2025 (AN)Key ↓

- A

- B

- C

- D

- E

- A
- Q21MSQ4 Marks·Choose all correct optionsEnd Term · 31 Aug 2025 (AN)Key ↓

- A

- B

- C

- D

- E

- F

- A
- Q22MSQ4 Marks·Choose all correct optionsEnd Term · 31 Aug 2025 (FN)Key ↓

- A

- B

- C

- D

- E

- F

- A
Type 5 · asked 4 times · Searching & sorting
Find which element could have been the quicksort pivot after first partition
- Q23MCQ4 Marks·Choose one optionEnd Term · 22 Dec 2024 (AN)Key ↓

- A55
- B58
- C60
- D48
- Q24MCQ4 Marks·Choose one optionEnd Term · 22 Dec 2024 (FN)Key ↓

- A70
- B100
- C35
- D111
- Q25MSQ4 Marks·Choose all correct optionsEnd Term · 31 Aug 2025 (AN)Key ↓

- A17
- B37
- C62
- D57
- E82
- Q26MSQ4 Marks·Choose all correct optionsEnd Term · 31 Aug 2025 (FN)Key ↓

- A13
- B8
- C9
- D10
- E11
Type 6 · asked 4 times · Complexity, growth & recurrences
Find the time complexity of a loop-based function
Type 7 · asked 4 times · Divide & conquer
Count the inversions (or inversion pairs) in a list
- Q31MCQ4 Marks·Choose one optionEnd Term · 22 Dec 2024 (AN)Key ↓

- A6
- B7
- C8
- D9
- Q32MSQ4 Marks·Choose all correct optionsEnd Term · 22 Dec 2024 (FN)Key ↓

- A(1,2)
- B(1,4)
- C(2,4)
- D(0,3)
- E(0,2)
- Q33MCQ4 Marks·Choose one optionEnd Term · 13 Apr 2025 (AN)Key ↓

- A8
- B6
- C4
- D2
- Q34NAT3 Marks·Write the numberQuiz 2 · 3 Aug 2025 (AN)Key ↓
Your answer:
Type 8 · asked 4 times · Complexity, growth & recurrences
Solve a recurrence like T(n)=aT(n/b)+f(n) to get its complexity
- Q35MCQ4 Marks·Choose one optionEnd Term · 22 Dec 2024 (AN)Key ↓

- A

- B

- C

- D

- A
- Q36MCQ4 Marks·Choose one optionEnd Term · 22 Dec 2024 (FN)Key ↓

- A

- B

- C

- D

- A
- Q37MCQ4 Marks·Choose one optionEnd Term · 13 Apr 2025 (AN)Key ↓

- A

- B

- C

- D

- A
- Q38MCQ3 Marks·Choose one optionQuiz 2 · 3 Aug 2025 (AN)Key ↓

- AA-3, B-1, C-2, D-4
- BA-4, B-1, C-3, D-2
- CA-4, B-1, C-2, D-3
- DA-1, B-3, C-2, D-4
Type 9 · asked 4 times · Dynamic programming
Count grid paths from (0,0) to (m,n) with DP, with or without blocks
Type 10 · asked 4 times · Dynamic programming
Matrix chain multiplication: best order or minimum multiplications
Type 11 · asked 4 times · Intractability & NP-completeness
Reason about P, NP, NP-hard and NP-complete reductions
- Q47MCQ4 Marks·Choose one optionEnd Term · 22 Dec 2024 (AN)Key ↓
Consider the following statements. 1. If an NP-hard problem A is polynomial time reducible to another problem B, then B belongs to the class NP. 2. If an NP-hard problem A is polynomial time reducible to another problem B, then B is NP- complete. Which of the following option is correct?
- AOnly statement 1 is true
- BOnly statement 2 is true
- CBoth statements 1 and 2 are true
- DBoth statements 1 and 2 are false
- Q48MCQ4 Marks·Choose one optionEnd Term · 22 Dec 2024 (FN)Key ↓
Consider the following statements. 1. If an NP-hard problem A is polynomial time reducible to another problem B, then B belongs to the NP class. 2. There exists polynomial time checking algorithm for all problems in the class P. Which of the following option is correct?
- AOnly statement 1 is true
- BOnly statement 2 is true
- CBoth statements 1 and 2 are true
- DBoth statements 1 and 2 are false
- Q49MCQ4 Marks·Choose one optionEnd Term · 31 Aug 2025 (AN)Key ↓

- AOnly statement 1 is correct
- BOnly statement 2 is correct
- CBoth the statements are correct
- DBoth the statements are wrong
- Q50MCQ4 Marks·Choose one optionEnd Term · 31 Aug 2025 (FN)Key ↓

- A

- B

- C

- D

- A
Type 12 · asked 4 times · Greedy: scheduling, Huffman, merging
Activity selection: max number of meetings in one room
Type 13 · asked 4 times · Complexity, growth & recurrences
Arrange functions in order of asymptotic growth
Type 14 · asked 3 times · Recursion, linked lists, stacks & queues
Trace a recursive function that pops and re-pushes a stack or queue
Type 15 · asked 3 times · Binary trees, BST & AVL trees
Find min or max nodes / max height of an AVL tree
Type 16 · asked 3 times · Greedy: scheduling, Huffman, merging
Optimal merge of sorted lists: total comparisons in worst case
Type 17 · asked 3 times · Searching & sorting
Trace binary search: iterations, comparisons or value of high
Type 18 · asked 3 times · Searching & sorting
Recall time complexity of a sorting algorithm in a given case
- Q71MCQ4 Marks·Choose one optionEnd Term · 13 Apr 2025 (AN)Key ↓
What is the worst case time complexity of Selection Sort ?
- A

- B

- C

- D

- A
- Q72MCQ4 Marks·Choose one optionEnd Term · 31 Aug 2025 (AN)Key ↓

- A

- B

- C

- D

- A
- Q73MSQ4 Marks·Choose all correct optionsEnd Term · 31 Aug 2025 (FN)Key ↓
Which of the following sorting algorithms will have the same time complexity irrespective of the sequence of elements in the input?
- ASelection Sort
- BMerge Sort
- CQuick Sort
- DInsertion Sort
Type 19 · asked 3 times · Graphs, BFS, DFS & topological sort
State the time complexity of BFS, Dijkstra or Kruskal
- Q74MCQ4 Marks·Choose one optionEnd Term · 13 Apr 2025 (AN)Key ↓
Consider a graph G with V vertices and E edges represented using an adjacency list. What is the worst case complexity for Breadth First Search?
- A

- B

- C

- D

- A
- Q75MCQ4 Marks·Choose one optionEnd Term · 31 Aug 2025 (AN)Key ↓

- A

- B

- C

- D

- A
- Q76MCQ4 Marks·Choose one optionEnd Term · 31 Aug 2025 (FN)Key ↓

- A

- B

- C

- D

- A
Type 20 · asked 3 times · Heaps & priority queues
Heap after delete_max/delete_min then insert
- Q77MCQ4 Marks·Choose one optionEnd Term · 13 Apr 2025 (AN)Key ↓

- A[41, 29, 26, 17, 15, 10, 9, 12, 11]
- B[41, 29, 26, 17, 15, 10, 9, 11, 12]
- C[41, 29, 26, 15, 17, 10, 9, 11, 12]
- D[41, 29, 26, 15, 17, 10, 9, 12, 11]
- Q78MCQ4 Marks·Choose one optionQuiz 2 · 3 Aug 2025 (AN)Key ↓

- A[12, 18, 20, 19, 32, 37, 27, 26, 29]
- B[12, 18, 20, 19, 32, 27, 37, 29, 26]
- C[12, 18, 19, 20, 27, 32, 37, 29, 26]
- D[12, 20, 18, 19, 32, 27, 37, 26, 29]
- Q79MCQ4 Marks·Choose one optionEnd Term · 31 Aug 2025 (AN)Key ↓

- A

- B

- C

- D

- A
Type 21 · asked 3 times · Binary trees, BST & AVL trees
Insert into an AVL tree and find the result or the leaves
Type 22 · asked 3 times · Binary trees, BST & AVL trees
Min height or max nodes of a binary tree
- Q83NAT3 Marks·Write the numberQuiz 2 · 3 Aug 2025 (AN)Key ↓
Your answer: - Q84NAT4 Marks·Write the numberEnd Term · 31 Aug 2025 (AN)Key ↓
What is the minimum possible height of a binary tree with 12 nodes (assuming the empty tree height is 0)?
Your answer: - Q85NAT4 Marks·Write the numberEnd Term · 31 Aug 2025 (FN)Key ↓
A binary tree has 7 nodes. What is the minimum possible height of this tree (assuming the empty tree height is 0)?
Your answer:
Type 23 · asked 2 times · Hashing & linear probing
Find probability the next key lands at an index with linear probing
Type 24 · asked 2 times · Hashing & linear probing
Find a possible key insertion order for a linear-probing hash table
- Q88MSQ4 Marks·Choose all correct optionsEnd Term · 13 Apr 2025 (AN)Key ↓

- A22, 33, 44, 52, 26, 63
- B22, 26, 33, 44, 52, 63
- C26, 44, 33, 22, 52, 63
- D33, 44, 52, 22, 26, 63
- E44, 33, 52, 22, 26, 63
- Q89MSQ4 Marks·Choose all correct optionsEnd Term · 31 Aug 2025 (AN)Key ↓

- A23, 36, 72, 12, 54, 83
- B36, 72, 23, 54, 12, 83
- C36, 23, 72, 12, 83, 54
- D36, 23, 72, 12, 54, 83
Type 25 · asked 2 times · Hashing & linear probing
Find the index where a key is stored with linear probing
Type 26 · asked 2 times · Recursion, linked lists, stacks & queues
Say what a recursive function on a list does
- Q92MCQ4 Marks·Choose one optionEnd Term · 22 Dec 2024 (AN)Key ↓

- A

- B

- C

- D

- A
- Q93MCQ4 Marks·Choose one optionEnd Term · 22 Dec 2024 (FN)Key ↓

- AIt finds the smallest element in D from index s1 to s2, both inclusive.
- BIt reverses the list D between indices s1 and s2, both inclusive
- CIt performs a merge sort in-place on this list D between indices s1 and s2, both inclusive
- DIt swaps the elements in D at indices s1 and s2, and leaves the remaining elements unchanged.
Type 27 · asked 2 times · Graphs, BFS, DFS & topological sort
BFS: compare d(s,u) and d(s,v) when u is visited before v
Type 28 · asked 2 times · Binary trees, BST & AVL trees
Check bounds linking height, internal, leaf and total nodes of a binary tree
- Q96MCQ4 Marks·Choose one optionEnd Term · 22 Dec 2024 (AN)Key ↓

- AOnly statement I is true
- BOnly statement II is true
- CBoth statements are true
- DBoth statements are not true
- Q97MCQ4 Marks·Choose one optionEnd Term · 22 Dec 2024 (FN)Key ↓

- AOnly statement I is true
- BOnly statement II is true
- CBoth statements are true
- DBoth statements are not true
Type 29 · asked 2 times · Binary trees, BST & AVL trees
True/false about inorder and postorder traversal of a BST
- Q98MCQ4 Marks·Choose one optionEnd Term · 22 Dec 2024 (AN)Key ↓
Which of the following statement(s) is/are correct about the traversals in a binary search tree? 1. The root of the tree is always the first element of the inorder traversal. 2. The root of the tree is always the last element of the postorder traversal.
- AOnly statement 1 is correct
- BOnly statement 2 is correct
- CBoth the statements are correct
- DNone of the statements are correct
- Q99MCQ4 Marks·Choose one optionEnd Term · 22 Dec 2024 (FN)Key ↓
Which of the following statement(s) is/are correct about the traversals in a binary search tree? 1. The inorder traversal sorts the elements in descending order. 2. The root of the tree is always the first element of the postorder traversal.
- AOnly statement 1 is correct
- BOnly statement 2 is correct
- CBoth the statements are correct
- DNone of the statements are correct
Type 30 · asked 2 times · Divide & conquer
Count inversions between two rankings of movies
Type 31 · asked 2 times · Graphs, BFS, DFS & topological sort
Pick valid (or invalid) topological orderings of a DAG
Type 32 · asked 2 times · Heaps & priority queues
Max-heap: find last inserted element or heap before last insert
Type 33 · asked 2 times · Minimum spanning trees
Find the weight of the minimum spanning tree
Type 34 · asked 2 times · Minimum spanning trees
Count MSTs plus their weight (alpha + beta)
Type 35 · asked 2 times · Divide & conquer
Trace median of medians on a given list
Type 36 · asked 2 times · Recursion, linked lists, stacks & queues
Code to insert or delete the first node of a linked list
Official KeyMaster Answer Key & Explanations
Official answer keys from IIT Madras BS past papers. Click any question to review.
Reveal KeyCollapse Key
Master Answer Key & Explanations
Official answer keys from IIT Madras BS past papers. Click any question to review.






































































