• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Top 50 Data Structures MCQs with Answers

Question 31

Which of the following is an advantage of adjacency list representation over adjacency matrix representation of a graph?
  • In adjacency list representation, space is saved for sparse graphs.
  • DFS and BSF can be done in O(V + E) time for adjacency list representation. These operations take O(V^2) time in adjacency matrix representation. Here is V and E are number of vertices and edges respectively.
  • Adding a vertex in adjacency list representation is easier than adjacency matrix representation.
  • All of the above

Question 32

What is the worst case efficiency for a path compression algorithm?
  • O(M log N)
  • O(N log N)
  • O(log N)
  • O(N)

Question 33

Trie is also known as _____

  • Treap

  • Binomial Tree

  • 2-3 Tree

  • Digital Tree

Question 34

Let G be a weighted undirected graph and e be an edge with maximum weight in G. Suppose there is a minimum weight spanning tree in G containing the edge e. Which of the following statements is always TRUE?  
  • There exists a cutset in G having all edges of maximum weight.
  • There exists a cycle in G having all edges of maximum weight
  • Edge e cannot be contained in a cycle.
  • All edges in G have the same weight

Question 35

An advantage of chained hash table (external hashing) over the open addressing scheme is

  • Worst case complexity of search operations is less

  • Space used is less

  • Deletion is easier

  • None of the above

Question 36

Given a hash table T with 25 slots that stores 2000 elements, the load factor α for T is __________

  • 80

  • 0.0125

  • 8000

  • 1.25

Question 37

Consider a hash table of size seven, with starting index zero, and a hash function (7x+3) mod 4. Assuming the hash table is initially empty, which of the following is the contents of the table when the sequence 1, 3, 8, 10 is inserted into the table using closed hashing ? Here “__” denotes an empty location in the table.
  • 3, 10, 1, 8, __ , __ , __
  • 1, 3, 8, 10, __ , __ , __
  • 1, __ , 3, __ , 8, __ , 10
  • 3, 10, __ , __ , 8, __ , __

Question 38

The keys 12, 18, 13, 2, 3, 23, 5 and 15 are inserted into an initially empty hash table of length 10 using open addressing with hash function h(k) = k mod 10 and linear probing. What is the resultant hash table?

[caption width="800"] [/caption]
  • A

  • B

  • C

  • D

Question 39

A hash table of length 10 uses open addressing with hash function h(k)=k mod 10, and linear probing. After inserting 6 values into an empty hash table, the table is as shown below. 

[caption width="800"] [/caption]

Which one of the following choices gives a possible order in which the key values could have been inserted in the table?

  • 46, 42, 34, 52, 23, 33

  • 34, 42, 23, 52, 33, 46

  • 46, 34, 42, 23, 52, 33

  • 42, 46, 33, 23, 34, 52

Question 40

An array A consists of n integers in locations A[0], A[1] ....A[n-1]. It is required to shift the elements of the array cyclically to the left by k places, where 1 <= k <= (n-1). An incomplete algorithm for doing this in linear time, without using another array is given below. Complete the algorithm by filling in the blanks. Assume alt the variables are suitably declared.

C++
min = n; i = 0;

while (___________) {	

     temp = A[i]; j = i;

     while (________) {

     A[j] = ________	

     j= (j + k) mod n ;

     If ( j< min ) then

         min = j;

}

A[(n + i  k) mod n] = _________

i = __________
  • i > min; j!= (n+i)mod n; A[j + k]; temp; i + 1 ;

  • i < min; j!= (n+i)mod n; A[j + k]; temp; i + 1;

  • i > min; j!= (n+i+k)mod n; A[(j + k)]; temp; i + 1;

  • i < min; j!= (n+i-k)mod n; A[(j + k)mod n]; temp; i + 1;

There are 50 questions to complete.

Last Updated :
Take a part in the ongoing discussion