Question 1 | MCQ
THIS IS QUESTION PAPER FOR THE SUBJECT"DIPLOMA LEVEL : PROGRAMMING, DATA
STRUCTURES AND ALGORITHMS USING PYTHON (COMPUTER BASED EXAM)"
ARE YOU SURE YOU HAVE TO WRITE EXAM FOR THIS SUBJECT?
CROSS CHECK YOUR HALL TICKET TO CONFIRM THE SUBJECTS TO BE WRITTEN.
(IF IT IS NOT THE CORRECT SUBJECT, PLS CHECK THE SECTION AT THE TOP FOR THE SUBJECTS REGISTERED BY YOU)
STRUCTURES AND ALGORITHMS USING PYTHON (COMPUTER BASED EXAM)"
ARE YOU SURE YOU HAVE TO WRITE EXAM FOR THIS SUBJECT?
CROSS CHECK YOUR HALL TICKET TO CONFIRM THE SUBJECTS TO BE WRITTEN.
(IF IT IS NOT THE CORRECT SUBJECT, PLS CHECK THE SECTION AT THE TOP FOR THE SUBJECTS REGISTERED BY YOU)
Solution
Which of the following statements istrueabout Dijkstra's algorithm to find the shortest path?
Solution
Let G = (V, E) be an undirected graph having distinct positive edge weights. Let V be partitioned into two non-empty sets X and Y. Let e = (s, t) be the minimum cost edge, with s belonging to X and t belonging to Y. Which of the following statement(s) is/are true?
1. The edge e must belong to each path from s to t.
2. The edge e must belong to the minimum cost spanning tree of G.
1. The edge e must belong to each path from s to t.
2. The edge e must belong to the minimum cost spanning tree of G.
Solution
Which of the following statements about the Floyd-Warshall algorithm is correct?
Solution
Consider a min-heap represented as the following list:

What are the leaf nodes of the resultant min-heap after the following operations are done on it?
1. delete_min()
2. insert(6)
What are the leaf nodes of the resultant min-heap after the following operations are done on it?
1. delete_min()
2. insert(6)
Solution
A standard max-heap contains
elements. What is the worst-case time complexity of the most efficient algorithm for finding the minimum element in a standard max-heap?
Solution
A Binary Search Tree (BST) is initially empty. The following keys are inserted in the given order:

Assume that the tree is a standard BST and no balancing operations are performed after insertion. How many comparisons are required to search for the key60in the resulting BST?
Assume that the tree is a standard BST and no balancing operations are performed after insertion. How many comparisons are required to search for the key60in the resulting BST?
Solution
We have n distinct values stored in a height-balanced (AVL) binary search tree. Which of the following statements is always true?
Solution
You are verifying a set of binary codes generated for a text file containing four unique characters:
.
Which of the following code allocations is invalid because it violates the fundamental prefix property required by Huffman coding?
Which of the following code allocations is invalid because it violates the fundamental prefix property required by Huffman coding?
Solution
Consider the following activities represented as(Start Time, Finish Time):

Two activities are considered compatible if the start time of one activity isgreater than or equal tothe finish time of the previously selected activity.
A greedy algorithm is used to select themaximumnumber of non-overlapping activities. How
many activities will be selected?
Two activities are considered compatible if the start time of one activity isgreater than or equal tothe finish time of the previously selected activity.
A greedy algorithm is used to select themaximumnumber of non-overlapping activities. How
many activities will be selected?
Solution
A text file contains 1000 characters. Originally, each character is represented using a fixed-length code of
bits.
After applying Huffman coding, the average code length becomes
bits per character. What percentage reduction in storage is achieved?
After applying Huffman coding, the average code length becomes
Solution
In the Divide-and-Conquer Closest Pair of points algorithm, why is brute force typically used when the number of points in a subproblem is at most 3?
Solution
Which of the following approaches can improve the worst-case running time of Quick Select to O(n)?
Solution
Inscript
Consider the undirected, weighted graph
with vertices
and the following edge weights:
-
-
-
-
-
Let
denote the total number of distinct Minimum Spanning Trees (MSTs) of
, and let
denote the total weight of any such Minimum Spanning Tree. What is the value of
?
Consider the undirected, weighted graph
-
-
-
-
-
Let
Solution
Inscript
Assume the following definition of height:
- Height of an empty tree = 0.
- Height of a tree with only a root node = 1.
What is the height of a complete binary tree that contains
nodes?
Assume the following definition of height:
- Height of an empty tree = 0.
- Height of a tree with only a root node = 1.
What is the height of a complete binary tree that contains
Solution
Inscript
In a list L of distinct elements, two elements
and
form an inversion if
and
.
Suppose L contains exactly 15 inversions. The minimum possible length ofLis___.
In a list L of distinct elements, two elements
Suppose L contains exactly 15 inversions. The minimum possible length ofLis___.
Solution
Consider the following recurrence relations:
1.
2.
3.
4.
Base Case:

Which of the above recurrences have asymptotic complexity
?
1.
2.
3.
4.
Base Case:
Which of the above recurrences have asymptotic complexity
Solution
Shape
Thickness [ / ]
3
All colors