uiz Space

May 2024 term · Programming, Data Structures and Algorithms using Python · BSCS2002

Programming, Data Structures and Algorithms using Python Quiz 2: 4 August 2024 (May 2024 term)

The IIT Madras BS Programming, Data Structures and Algorithms using Python (PDSA) Quiz 2 paper sat on 4 Aug 2024, in the May 2024 term: 16 questions for 50 marks in 120 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.

Questions
16
Marks
50
Duration
120 min
MCQ
10
Numerical
3
MSQ
3

Updated

Official paper: IIT M DIPLOMA AN EXAM QDD2 4 Aug 2024 · No negative marking.

Question 1

+4 marksOne correct option
  1. A

    A, C, F, B, E, D

  2. B

    A, C, F, B, D, E

  3. C

    A, C, B, F, E, D

  4. D

    A, C, B, F, D, E

Show answer

Correct answer

  • A

    A, C, F, B, E, D

Question 2

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

Correct answer

  • B

Question 3

+3 marksOne correct option

Consider a directed graph G with equal edge weights. Which of the following algorithms is most efficient to compute the shortest distance between every pair of nodes in G?

  1. A

    Run BFS once on every node

  2. B

    Run Dijkstra’s algorithm once on every node

  3. C

    Run Bellman Ford’s algorithm once on every node

  4. D

    Run Floyd-Warshall algorithm

Show answer

Correct answer

  • A

    Run BFS once on every node

Question 4

+3 marksOne correct option
  1. A

    Only 1

  2. B

    Only 2

  3. C

    Both 1 and 2

  4. D

    Neither 1 nor 2

Show answer

Correct answer

  • C

    Both 1 and 2

Question 5

+3 marksOne correct option
  1. A

    [6, 7, 13, 9, 19, 16, 21, 26, 11]

  2. B

    [6, 7, 13, 9, 19, 16, 21, 11, 26]

  3. C

    [6, 7, 13, 9, 19, 21, 16, 26, 11]

  4. D

    [6, 7, 13, 9, 19, 21, 16, 11, 26]

Show answer

Correct answer

  • A

    [6, 7, 13, 9, 19, 16, 21, 26, 11]

Question 6

+3 marksOne correct option

Which one of the following is a possible sequence of elements in root-to-leaf paths in a top-down fashion in a binary search tree?

  1. A

    50, 10, 36, 40, 31, 46

  2. B

    50, 90, 75, 88, 62, 68

  3. C

    45, 50, 49, 48, 44, 47

  4. D

    45, 50, 46, 49, 47, 48

Show answer

Correct answer

  • D

    45, 50, 46, 49, 47, 48

Question 7

+3 marksOne correct option

While inserting the elements 45, 75, 15, 55, 5, 40, 62, 25, and 85 in an empty binary search tree in the sequence shown, the elements at maximum depth from root are__________________.

  1. A

    40, 85

  2. B

    25, 40

  3. C

    62, 85

  4. D

    25, 62

Show answer

Correct answer

  • D

    25, 62

Question 8

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

Correct answer

  • A

Question 9

+3 marksOne correct option
  1. A

    4

  2. B

    3

  3. C

    2

  4. D

    1

Show answer

Correct answer

  • C

    2

Question 10

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

Correct answer

  • B

Question 11

+3 marksNumerical answer

Let G be a complete undirected graph with 5 vertices and 10 edges with weights of 1, 2, 3, 4, 5, 6, 7, 8, 9 and 10. The maximum possible weight that a minimum weight spanning tree of G can have is __________________.

Show answer

Correct answer: 14

Question 12

+3 marksNumerical answer
Show answer

Correct answer: 256

Question 13

+3 marksNumerical answer
Show answer

Correct answer: 13

Question 14

+3 marksOne or more correct options

Which of the following statements is/are true for Heap sort?

Select all that apply.

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answers

  • A
  • C

Question 15

+3 marksOne or more correct options

For a set of symbols with probabilities of occurrence, which of the following statement(s) is/are true about the Huffman algorithm?

Select all that apply.

  1. A

    Symbols with lower probabilities value are generally closer to the root of the Huffman tree.

  2. B

    The Huffman tree is always a strict binary tree (each node has two children, except leaf nodes).

  3. C

    It generates prefix codes (no code is a prefix of another).

  4. D

    If probability values are distinct, then two symbols with the lowest probabilities always have the same code length.

  5. E

    There is always at least one symbol with a code of length one.

Show answer

Correct answers

  • B

    The Huffman tree is always a strict binary tree (each node has two children, except leaf nodes).

  • C

    It generates prefix codes (no code is a prefix of another).

  • D

    If probability values are distinct, then two symbols with the lowest probabilities always have the same code length.

Question 16

+3 marksOne or more correct options

Select all that apply.

  1. A

    coins=[1, 2, 8, 9, 5, 10] and x = 13

  2. B

    coins=[10, 1, 2, 5] and x = 25

  3. C

    coins=[6, 1, 5, 7] and x = 15

  4. D

    coins = [1, 6, 7, 10, 15] and x = 35

  5. E

    coins = [1, 2, 5, 10, 25] and x = 40

Show answer

Correct answers

  • A

    coins=[1, 2, 8, 9, 5, 10] and x = 13

  • D

    coins = [1, 6, 7, 10, 15] and x = 35