PracticeTest2 CSD201 ODD
PracticeTest2 CSD201 ODD
PracticeTest2 CSD201 ODD
Time (60 minutes) The Question will be submitted along with your source code
to edu-next.
ii. A binary tree is balanced if, for any two leaves, the difference of the depth is at most 1.
3. Searching and sorting algorithms are best implemented with which data structure?
a. An array-based list
b. A linked list
c. Both of the above
d. None of the above
5. The following best describes which algorithm? The elements are compared and swapped if the first
is found to be greater than the next element.
a. Selection-sort algorithm
b. Quick-sort algorithm
c. Bubble-sort algorithm
d. None of the above
a. G is a complete graph
b. G is not a connected graph
c. The vertex connectivity of the graph is 2
d. The edge connectivity of the graph is 1
c. n’s left and right subtrees have heights that differ by at most one.
d. n’s left and right subtrees have sizes that differ by at most one
8. The set of all addition edges generated by the BFS tree starting at node A is.
a. BDFGCE
b. D
c. ACDGFE
d. Cannot be generated
9. The set of all edges generated by the DFS tree starting at node B is.
a. BADCGFE
b. BCDAFEG
c. BGCEDAF
d. Cannot be generated
10. The common data structure required for Breadth First Traversal on a graph is.
a. Stack
b. Queue
c. Tree
d. All of the above
11 Which is the correct order for Kruskal’s minimum spanning tree algorithm to add edges to
the minimum spanning tree for the figure shown Below?
a. (AD)(BD)(DE)(EG)(GF)(AC)
b. (AD)(EG)(BD)(BE)(GF)(AC)
c. None of the above
d. Both of the above
12. For minimum spanning tree (MST) construction, Prim’s algorithm selects?
a. With minimum weight so that the cost of MST is always minimum
b. with the maximum number of vertices connected to it so that MST has the least
diameter
c. that does not introduce a cycle
d. that adds a new vertex to a partially constructed tree with minimal increment in the
cost of MST
13. Suppose a hash table can contain 10 entries and if required, it uses linear probing to
resolve collisions. Using key % 10 as a hash function, if key values 41, 165, 62, 123, 142 are
hashed, then the location of the key 142 is?
a. 2
b. 3
c. 4
d. 5
e. 6
15. Suppose we remove the root node from the following BST tree, which could be
the new root?
a. 2
b. 1
c. 5
d. 4
16. Suppose we are sorting an array of eight integers using quick sort, and we have just
finished the first partitioning with the array looking like this: 2 5 1 7 9 12 11 10 Which
statement is correct?
a. the pivot could be 7 or 9
b. the pivot could be 7
c. the pivot could be 9
d. none of the above
17. In the quick sort method, a desirable choice for the portioning element in real-life data
will be?
a. The first element of the list.
b. The median element of the list.
c. The last element of the list.
d. The average value.
18, The number of swapping needed to sort the numbers 8,22,7,9,31,19,5,13 in the bubble-
sort algorithm for ascending order?
a. 14
b. 12
c. 13
d. 11
19) Consider a hash table of size seven, with starting index zero, and a hash function
(3x + 4) mod 11.
Assuming the hash table is initially empty and has a size of 10,
which of the following is the contents of the table when the sequence 1, 3, 8, 10, 7, 6?
a. 726130
b. 1 3 8 6 7 10
c. 6 10 3 7 8 1
d. 10 8 7 6 3 1