Indian Institute of Technology Madras
BS Degree Programme · Examination & Study Paper
Programming, Data Structures and Algorithms using Python
Graphs, BFS, DFS & topological sort
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.
Quiz 1 · 26 Oct 2025 (AN)Quiz 1
- Q1MSQ3 Marks·Choose all correct options

- A

- B

- C

- D

- E

- A
- Q2MSQ3 Marks·Choose all correct options
Consider a connected, undirected graph G with n vertices. A Breadth-First Search (BFS) traversal is performed starting from a source vertex s. Let d(s, v) denote the shortest distance (in terms of number of edges) from s to vertex v. Which of the following statements is true about the BFS traversal?
- AAll vertices at distance k from s are visited before any vertex at distance k + 1 from s.
- BOnce a vertex is visited, it is never visited again during the traversal.
- CBFS may fail to visit some vertices, even if the graph is connected.
- DThe time complexity of BFS using an adjacency list representation is O(n^2).
- Q3NAT3 Marks·Write the number
Your answer: - Q4NAT3 Marks·Write the number
Your answer: - Q5NAT3 Marks·Write the number
Your answer:
End Term · 31 Aug 2025 (FN)End Term
- Q6MCQ4 Marks·Choose one option

- A

- B

- C

- D

- A
- Q7MCQ4 Marks·Choose one option

- A

- B

- C

- A
- Q8NAT4 Marks·Write the number
An undirected graph has 300 edges. What is the minimum number of vertices it must have?
Your answer:
End Term · 31 Aug 2025 (AN)End Term
- Q9MCQ4 Marks·Choose one option
Consider the following statements: 1. While creating a DFS tree for a directed graph, among non-tree edges, only back edges correspond to cycles. 2. The depth of any DFS tree rooted at a vertex is at least as much as the depth of any BFS tree rooted at the same vertex. Choose the correct option.
- AOnly statement 1 is true
- BOnly statement 2 is true
- CBoth statements 1 and 2 are true
- DBoth statements 1 and 2 are false
- Q10MSQ4 Marks·Choose all correct options

- A1
- B5
- C3
- D4
- E6
- F7
- Q11NAT4 Marks·Write the number
What is the maximum number of edges in a directed graph with 9 vertices?
Your answer:
End Term · 13 Apr 2025 (AN)End Term
- Q12MCQ4 Marks·Choose one option

- A

- B

- C

- D

- A
- Q13MCQ4 Marks·Choose one option
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
- Q14MSQ4 Marks·Choose all correct options
Which of the following statement is/are false?
- A

- B

- C

- D

- A
End Term · 22 Dec 2024 (FN)End Term
- Q15MSQ4 Marks·Choose all correct options

- AP Q R S T U V
- BP R Q V S U T
- CP Q R S V U T
- DP R Q S V T U
- Q16NAT4 Marks·Write the number
Your answer:
End Term · 22 Dec 2024 (AN)End Term
- Q17MCQ4 Marks·Choose one option

- A

- B

- C

- D

- A
- Q18NAT4 Marks·Write the number
Your answer: