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
Inscript
What does the function
return?

What does the function
Solution
Inscript
Consider the following implementation for Stack

Which of the following is the return value of the function call
?
Consider the following implementation for Stack
Which of the following is the return value of the function call
Solution
Inscript
Consider a graph with 4 vertices
, where all edges running along the perimeter have identical weights, and the single diagonal edge has a different value:

How many distinct, unique minimum spanning trees can be generated for this graph?
Consider a graph with 4 vertices
How many distinct, unique minimum spanning trees can be generated for this graph?
Solution
Inscript
A custom currency system uses the coin denominations
. A student applies the standard greedy strategy (always choosing the largest possible coin denomination that does not exceed the remaining target amount) to make change for a target value of
.
What is the smallest integer target value
for which this greedy strategy fails to find the optimal solution (i.e., it returns a strictly greater number of coins than the absolute minimum required)?
A custom currency system uses the coin denominations
What is the smallest integer target value
Solution
Inscript
Consider the following function

What median value will be returned by the given
function for the following list?

Consider the following function
What median value will be returned by the given
Solution
Inscript
Consider the following grid.

How many unique paths are available from
to
? Condition is that you can only travel one-step right or one step up at a time, and blue boxes at intersection points
and 
represent blockages.
Consider the following grid.
How many unique paths are available from
represent blockages.
Solution
Inscript
Let
be a simple graph with 17 vertices. The size of the minimum vertex cover of
is 7. What is the size of the maximum independent set of graph
?
Let
Solution
Suppose f(n) is
. Consider the following statements.
(i) f(n) is
(ii) f(n) is
(iii) f(n) is 
Which of the following istrue?
(i) f(n) is
Which of the following istrue?
Solution
We have a list of three dimensional points:

We sort these in ascending order by the third coordinate. Which of the following corresponds to a stable sort of this input?
We sort these in ascending order by the third coordinate. Which of the following corresponds to a stable sort of this input?
Solution
Consider an empty hash table of size
using open addressing with quadratic probing:
, where
represents the probe number.
The keys
are inserted into the table sequentially. What will the hash table look like after these insertions?
The keys
Solution
Consider a simple, undirected graph
with
vertices. Which of the following degree sequences could not possibly belong to
, even if the graph is disconnected?
Solution
Suppose a directed graph
contains a negative-weight cycle. We run the Bellman-Ford algorithm starting from a source vertex
.
Under which condition will the algorithm fail to detect this negative-weight cycle during its final (
-th) iteration check?
Under which condition will the algorithm fail to detect this negative-weight cycle during its final (
Solution
In a binary tree
, if the number of leaf nodes is exactly 15, what is the total number of nodes in the tree that have exactly two children?
Solution
Which of the following lists does not represent a valid
?
Solution
Consider a Binary Search Tree containing the keys
. The root node is
, and its left and right children are
and
, respectively.
If you execute a standard deletion operation to remove the root node
, which of the following keys can cleanly replace the root position to keep the structural properties of the BST intact without requiring major reorganization?
If you execute a standard deletion operation to remove the root node
Solution
Consider an initially empty AVL tree. We insert the following keys in the exact sequence given:
. Which specific node insertion acts as the trigger that forces the tree to execute a Double Rotation?
Solution
Suppose the letters {A, B, C, D, E} occur with the following frequencies.

How many bits will be used to encode the letterAin the Huffman code for this alphabet?
How many bits will be used to encode the letterAin the Huffman code for this alphabet?
Solution
Consider a base-case subproblem encountered during the execution of the Closest Pair algorithm that contains exactly 3 points:
,
, and
.
What is the local minimum distance (
) evaluated by this brute-force base case, and how many unique pairwise distance calculations must be performed to find it?
What is the local minimum distance (
Solution
Consider the following function:

What is thepurposeof the above function?
What is thepurposeof the above function?
Solution
A boutique bakery produces specialty gift baskets containing boxes of Artisan Cookies (
) and Gourmet Chocolates (
). For production, the kitchen has 800 kg of premium flour and 1200 kg of refined sugar available in their inventory.
- Each box of Cookies (
) requires 2 kg of flour and 1 kg of sugar.
- Each box of Chocolates (
) requires 1 kg of flour and 3 kg of sugar.
The profit is fixed at Rs. 150 per box of cookies and Rs. 200 per box of chocolates. The objective function is to maximize total profit
.
Which of the following is not a valid constraint for this linear programming problem?
- Each box of Cookies (
- Each box of Chocolates (
The profit is fixed at Rs. 150 per box of cookies and Rs. 200 per box of chocolates. The objective function is to maximize total profit
Which of the following is not a valid constraint for this linear programming problem?
Solution
Which of the following statements is/aretrueabout quicksort?
Solution
Let
be a simple, undirected graph with
vertices. If
is disconnected, which of the following could be the total number of edges (
) in
? (Select all that apply)
Solution
Which of the following statements is/arefalseregarding the topological sorting of a graph? (Select all that apply)
Solution
In the standard Inversion Count problem, a pair of numbers in an array is called an"inversion"if a larger number appears before a smaller number.
If we have the array
, which pair of numbers forms a valid inversion?
If we have the array
Solution
Which of the following denote non-polynomial time complexity?
Solution
Shape
Thickness [ / ]
3
All colors