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 functionf(1000,2)return?

What does the functionf(1000,2)return?
Solution
Inscript
Consider the following implementation for Queue

Which of the following is the return value of the function call
?
Consider the following implementation for Queue
Which of the following is the return value of the function call
Solution
Inscript
Consider the undirected, weighted graph
shown below:

What is the total weight of the Minimum Spanning Tree (MST) of this graph?
Consider the undirected, weighted graph
What is the total weight of the Minimum Spanning Tree (MST) of this graph?
Solution
Inscript
If you insert the elements
into an empty Binary Search Tree (BST) in the sequence listed, which element forms a leaf node at the maximum depth?
If you insert the elements
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
Solution
Inscript
Let
be a simple graph with
vertices. The size of the minimum vertex cover of
is 8 and the maximum independent set of
is 9. What is the total number of vertices in the 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 an undirected graph
with
vertices and the following degree sequence:

Which of the following statements is correct regarding this graph?
Which of the following statements is correct regarding this graph?
Solution
Suppose we run the Bellman-Ford algorithm on a directed graph where every edge weight is strictly positive. Which of the following statements accurately describes the behavior of the algorithm?
Solution
A strict (or full) binary tree is defined as a binary tree where every internal node has exactly two children (no node has exactly one child).
If a strict binary tree has 25 leaf nodes, what is the total number of nodes (
) in the entire tree?
If a strict binary tree has 25 leaf nodes, what is the total number of nodes (
Solution
Consider the following min-heap:

If we perform two consecutive insertions:
followed by
, what will be the final array representation of the min-heap?
If we perform two consecutive insertions:
Solution
Suppose the letters {A, B, C, D, E} occur with the following frequencies.

How many bits will be used to encode the letterEin the Huffman code for this alphabet?
How many bits will be used to encode the letterEin the Huffman code for this alphabet?
Solution
Consider a base-case subproblem encountered during the execution of the
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 (δ) evaluated by this brute-force base case, and how many unique pairwise distance calculations must be performed to find it?
Solution
Consider the following function:

What does the function
compute?
What does the function
Solution
A tech firm contracts a manufacturer to assemble premium tablets and smartphones. For assembly materials, the factory has 600 hours of electronic testing lab time and 900 hours of precision welding line time available per week.
- Every tablet (
) requires 1 hour of testing and 3 hours of welding.
- Every smartphone (
) requires 2 hours of testing and 1.5 hours of welding.
The profit is fixed at Rs. 800 for each tablet and Rs. 500 for each smartphone. The objective function is to maximize weekly profit
.
Which of the following is not a valid constraint for this linear programming problem?
- Every tablet (
- Every smartphone (
The profit is fixed at Rs. 800 for each tablet and Rs. 500 for each smartphone. The objective function is to maximize weekly profit
Which of the following is not a valid constraint for this linear programming problem?
Solution
Which of the following statements provides the most accurate definition of the complexity class NP?
Solution
Which of the following statements is/aretrueabout quicksort?
Solution
Let G be a simple, undirected graph with n = 10 vertices. If G is disconnected, which of the following could be the total number of edges (e) in G? (Select all that apply)
Solution
Suppose we run a Breadth-First Search (BFS) on a connected, undirected graph and obtain the following BFS tree rooted at node
:

Which of the following edges cannot be present in the original graph? (Select all that apply)
Which of the following edges cannot be present in the original graph? (Select all that apply)
Solution
An element is inserted into an AVL tree, causing a critical imbalance at a node
. The imbalance requires a Left-Right (LR) double rotation to restore balance. Let
be the left child of
, and
be the right child of
(the node that becomes the new root of this subtree after rotation).
During the two sub-rotation phases, what happens to the subtrees of
(let's call them
and
, representing
's original left and right subtrees)? (Select all that apply)
During the two sub-rotation phases, what happens to the subtrees of
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
Shape
Thickness [ / ]
3
All colors