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)
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
Consider the following strategy to solve the single source shortest path problem with positive integer edge weights from a source vertex s:
Replace each edge with weight w by w edges of weight 1 connected by new intermediate nodes. Run BFS(s) on the modified graph to find the shortest path to each of the original vertices in the graph.
Which of the following statement is true?
Replace each edge with weight w by w edges of weight 1 connected by new intermediate nodes. Run BFS(s) on the modified graph to find the shortest path to each of the original vertices in the graph.
Which of the following statement is true?
Solution
Which of the following statements istrueabout Dijkstra's algorithm to find the shortest path?
Solution
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 definitely belong to each path from s to t.
2. The edge e must definitely belong to the minimum cost spanning tree of G.
1. The edge e must definitely belong to each path from s to t.
2. The edge e must definitely belong to the minimum cost spanning tree of G.
Solution
Consider a max-heap represented as the following list:
[30, 20, 25, 5, 15, 23, 10, 3, 2]
What are the leaf nodes of the resultant max-heap after the following operations are done on it?
1. delete_max()
2. Insert(24)
[30, 20, 25, 5, 15, 23, 10, 3, 2]
What are the leaf nodes of the resultant max-heap after the following operations are done on it?
1. delete_max()
2. Insert(24)
Solution
Solution
The maximum element of a BST is always guaranteed to be____________.
Solution
Solution
Define theheight balance factororslopeof a node as the absolute difference in height of the left subtree and the right subtree of the node.
Create a binary search tree by inserting the following elements in the given order one at a time (Do not perform any rotations on this tree as you insert the items. It’s just a binary search tree, not necessarily a balanced BST)
3, 1, 2, 4, 6, 5, 7, 8
What is the height balance factor or slope of the root node of this tree? Consider that the height of the empty tree is 0.
Create a binary search tree by inserting the following elements in the given order one at a time (Do not perform any rotations on this tree as you insert the items. It’s just a binary search tree, not necessarily a balanced BST)
3, 1, 2, 4, 6, 5, 7, 8
What is the height balance factor or slope of the root node of this tree? Consider that the height of the empty tree is 0.
Solution
Create an AVL tree by inserting the following elements in the given order (one at a time):
4, 7, 1, 3, 5, 6, 2, 8
What would be the sum of elements stored in leaf nodes of the resultant AVL tree?
4, 7, 1, 3, 5, 6, 2, 8
What would be the sum of elements stored in leaf nodes of the resultant AVL tree?
Solution
Solution
Solution
Solution
Solution
Consider the following statements and choose the correct ones.
Solution
Solution
Shape
Thickness [ / ]
3
All colors