Site navigation

Data Structures and Algorithms MCQs with Answers

Try the topic preview and open any solution for a worked explanation.

Question 1

The postfix form of the expression (A + B) * (C * D ‐ E) * F / G is _______ .

Select one answer

Question 2

Which of the given options provides the increasing order of asymptotic complexity of functions f1, f2, f3 and f4?

A. f1(n) = 2n

B. f2(n) = n3/2

C. f3(n) = n log n

D. f4(n) = nlog n

Select one answer

Question 3

In the following table, the left column contains the names of standard graph algorithms and the right column contains the time complexities of the algorithms. Here, n and m are number of vertices and edges, respectively. Match each algorithm with its time complexity.

List I (Standard graph algorithms)List II (Time complexities)
A. Bellman-Ford algorithmI. O(m*log n)
B. Kruskal’s algorithmII. O(n3)
C. Floyd-Warshall algorithmIII. O(n*m)
D. Topological sortingIV. O(n+m)
Select one answer

Question 4

A data structure is required for storing a set of integers such that each of the following operations can be done in O(log n) time, where n is the number of elements in the set.
Deletion of the smallest element
Insertion of an element if it is not already present in the set
Which of the following data structures can be used for this purpose?

Select one answer

Question 5

A hash table has space for 75 records. What is the approximate probability of a collision when 6 records are inserted (i.e. when the table is 8% full)?

Select one answer

Question 6

The number of nodes in a complete binary tree of height h (with root at level 0) is equal to:

Select one answer

Question 7

What item is at the root after the following sequence of insertions into an empty splay tree :
1, 11, 3, 10, 8, 4, 6, 5, 7, 9, 2, ?

Select one answer

Question 8

Suppose we are implementing quadratic probing with a Hash function, Hash(y) = X mode 100. If an element with key 4594 is inserted and the first three locations attempted are already occupied, then the next cell that will be tried is :

Select one answer

Question 9

What operation is supported in constant time by the doubly linked list, but not by the singly linked list ?

Select one answer

Question 10

The initial configuration of quaue is a, b, c, d. ‘a’ is at the front. To get the configuration d, c, b, a how many deletions and additions required :
Select one answer

Practise for these exams

  • UGC NET Computer Science and Applications

  • UGC NET Paper I