PDSA End Term: 1 September 2024, Set QDF3 (May 2024 term)
The IIT Madras BS Programming, Data Structures and Algorithms using Python (PDSA) End Term paper sat on 1 Sept 2024, in the May 2024 term, set QDF3: 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.
- 25
- 100
- 180 min
- 14
- 5
- 6
Show answer
Correct answer
Question 2
10
11
12
13
Show answer
Correct answer
12
Question 3
Show answer
Correct answer
Question 4
What is recurrence and time complexity for the worst case of Quick Sort ? Consider that algorithm select last element as pivot element.
Show answer
Correct answer
Question 5
I
F
E
H
G
Show answer
Correct answer
E
Question 6
Consider the following graph
Which of the following vertex sequence is the correct BFS traversal on the graph started from node 7? Assume that when a node has multiple neighbours, BFS would visit the numerically smaller valued node first.
Show answer
Correct answer
Question 7
Which of the following statements is true about Dijkstra's algorithm to find the shortest path? I. The shortest path returned by Dijkstra's algorithm always passes through the least number of vertices.
II. To decide which node to visit next, Dijkstra's algorithm selects the node with maximum known distance.
Only I is correct
Only II is Correct
Both I and II are correct
Both I and II are incorrect
Show answer
Correct answer
Both I and II are incorrect
Question 8
Which of the following is/are always true about the Bellman-Ford algorithm?
I. It can not detect negative weight cycles in graph.
II. It works correctly if the graph has negative edge weights but does not have negative weight cycles.
III. It finds the shortest paths from a single source vertex to all other vertices in the graph.
Only statement I and II are correct
Only statement I and III are correct
Only statement II and III are correct
All statements are correct
All statements are incorrect
Show answer
Correct answer
Only statement II and III are correct
Question 9
12
11
8
14 is a leaf node.
Show answer
Correct answer
14 is a leaf node.
Question 10
Show answer
Correct answer
Question 11
Show answer
Correct answer
Question 12
Let Z be an NP-complete problem and X and Y be two other problems not known to be in NP. X is polynomial time reducible to Z and Z is polynomial-time reducible to Y. Which one of the following statements is true?
Y is NP-complete
Y is NP-hard
X is NP-complete
X is NP-hard
Show answer
Correct answer
Y is NP-hard
Question 13
Show answer
Correct answer: 4
Question 14
Show answer
Correct answer: 19
Question 15
Show answer
Correct answer: 6
Question 16
Show answer
Correct answer: 5
Question 17
Show answer
Correct answer: 43
Question 18
Show answer
Correct answers
Question 19
A baker is preparing an elaborate cake M. The recipe includes preparing several other components, each of which has its dependencies. The order in which these components must be prepared is given below:
1. Component X is used to make components P and Q.
2. Component Y is added to prepare components R and S.
3. Component T is prepared by mixing components Q and R.
4. Component Y is made by blending X.
5. Component U is made by mixing P and T.
6. Component V is made by adding sugar to component S.
7. The cake M is assembled by layering components U and V together.
The baker has enough assistants to prepare multiple components simultaneously, allowing the cake M to be completed in the minimum number of steps, considering all dependencies. Each step represents a time unit during which one or more components can be prepared in parallel. The component(s) prepared in the 3rd step is/are ___.
Q
T
R
U
S
Show answer
Correct answers
R
S
Question 20
Consider a binary min-heap implemented using list. Which of the following lists represents a binary min-heap?
[6, 8, 15, 20, 12, 17, 21]
[6, 8, 17, 20, 12, 15, 21]
[6, 8, 15, 20, 17, 12, 21]
[6, 8, 17, 12, 15, 20, 21]
Show answer
Correct answers
[6, 8, 15, 20, 12, 17, 21]
[6, 8, 17, 12, 15, 20, 21]
Question 21
Which of the following are possible valid codes for the character set S = {A, B, C, D, E, F}, generated using the Huffman algorithm?
Show answer
Correct answers
Question 22
Show answer
Correct answers
Question 23
Consider the network given below with source s and sink t, with the numbers on the edges denoting maximum capacity across a particular edge.
Which of the following edges form a valid min cut in the given network?
Edges {ce, cd}
Edges {ac, ce, de}
Edges {fg, fi, hi}
Edges {fg, fh}
Edges {ij, ik}
Show answer
Correct answers
Edges {fg, fi, hi}
Edges {ij, ik}
Question 24
Based on the above data, answer the given subquestions.
Show answer
Correct answer
Question 25
Based on the above data, answer the given subquestions.
Show answer
Correct answer
