Question 1
+4 marksOne or more correct optionsSelect all that apply.
- A
- B
- C
- D
The IIT Madras BS Programming, Data Structures and Algorithms using Python (PDSA) End Term paper sat on 3 Sept 2023, in the May 2023 term, set QPD1-S1: 26 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.
Correct answers
Which of the following statement(s) is/are true?
Correct answers
coins = [6, 1, 5, 7] and x = 15
coins = [10, 1, 2, 5] and x = 25
coins = [1, 2, 8, 9, 5, 10] and x = 17
coins = [1, 5, 10, 25] and x = 30
coins = [1, 6, 10, 15] and x = 24
Correct answers
coins = [1, 2, 8, 9, 5, 10] and x = 17
coins = [1, 6, 10, 15] and x = 24
Which of the following sorting algorithms will have the same time complexity irrespective of the sequence of elements in the input?
Selection Sort
Merge Sort
Quick Sort
Insertion Sort
Correct answers
Selection Sort
Merge Sort
Which of the following statement(s) is/are correct with regard to the given Selection Sort? 1. Selection sort is stable sort.
2. It sorts In-place.
3. In Selection sort, after m passes through the list, the first m elements in the list are the m smallest element of the list.
Only statement 2 is true
Statement 1 and Statement 2 are true
Statement 2 and Statement 3 are true
Statement 1 and Statement 3 are true
All statements are true
Correct answer
Statement 2 and Statement 3 are true
Correct answer
79, 22, 35, 15, 16, 77, 25
22, 35, 77, 16, 25, 79, 15
35, 16, 77, 15, 22, 25, 79
77, 79, 16, 35, 15, 22, 25
Correct answer
77, 79, 16, 35, 15, 22, 25
An airline serves 1000 cities and runs 4500 direct flights each day between these cities. Which of the following is a good data structure to get the list of cities where direct flight available from any particular cities?
Correct answer
Consider the following graph
If Dijkstra algorithm is used with A as the source vertex then what is the order in which all other vertices are visited?
A, B, E, D, F, C
A, B, D, E, C, F
A, B, E, D, C, F
A, B, D, E, F, C
Correct answer
A, B, E, D, C, F
The post-order traversal of a binary search tree with integer values produces the following sequence: 7, 5, 14, 12, 10, 20, 18, 25, 15. What is the value of the left child of the root of the tree?
14
12
10
7
18
Correct answer
10
If we do not maintain the height of subtrees at each node in an AVL tree, then what will be the upper bound of running time for inserting an element and balancing it if required?
Correct answer
Correct answer
Correct answer
Correct answer
[0, 0, 1, 2, 1, 1, 2, 3]
[0, 0, 1, 1, 2, 1, 2, 0]
[0, 0, 1, 2, 0, 1, 2, 0]
[0, 0, 1, 1, 1, 0, 1, 2]
Correct answer
[0, 0, 1, 2, 0, 1, 2, 0]
1-d, 2-a, 3-c, 4-b
1-d, 2-b, 3-c, 4-a
1-d, 2-a, 3-d, 4-c
1-a, 2-d, 3-c, 4-b
Correct answer
1-d, 2-a, 3-c, 4-b
Correct answer
Consider the following DAG
How many possible topological orderings are there for the given DAG ?
Correct answer: 6
Consider the graph G given below.
The number of minimum cost spanning tree for the given graph is__.
Correct answer: 2
In a binary tree T of 25 nodes, if the number of nodes with two children is 6, then the number of nodes with one child is ___
Correct answer: 12
Correct answer: 213
Correct answer: 55
Correct answer: 19000
Correct answer: 3
Correct answer: 22
Let G be a graph. The size of the minimum vertex cover of G is 12 and the size of the maximum independent set of G is 17. What are the number of the vertices in graph G?
Correct answer: 29