Data Structure MCQ

Data Structure MCQ

  • Admin
  • 08th Jun, 2022

Data Structure MCQ With Answers

Following are mostly asked Data structure MCQ test that are designed for professionals like you to crack you interviews. You can take this Data structure online test before appearing to you real interview. This Data structure quiz there are around 30+ multiple choice questions on Data structure with four options.

1) For a binary search algorithm to work, it is necessary that the array (list) must be

  • A. sorted
  • B. unsorted
  • C. in a heap
  • D. popped out of stack

2) What could be the worst case height of an AVL tree?

  • A. 0.97 log n
  • B. 2.13 log n
  • C. 1.44 log n
  • D. 2.17logn

3) How many swaps are required to sort the given array using bubble sort - { 2, 5, 1, 3, 4}

  • A. 5
  • B. 6
  • C. 7
  • D. 4

4) Project scheduling is an example of

  • A. greedy programming
  • B. divide and conquer
  • C. none of the above.
  • D. dynamic programming

5) Binary search tree has best case run-time complexity of O(log n). What could the worst case?

  • A. O(n)
  • B. O(n2)
  • C. O(n3)
  • D. None of the above
Download Free : Data Structure MCQ PDF

6) Which of the following sorting algorithms can be used to sort a random linked list with minimum time complexity?

  • A. Heap Sort
  • B. Quick Sort
  • C. Insertion Sort
  • D. Merge Sort

7) The concatenation of two lists is to be performed in O(1) time. Which of the following implementations of a list should be used?

  • A. singly linked list
  • B. doubly linked list
  • C. circular doubly linked list
  • D. array implementation of lists

8) Suppose there are two singly linked lists both of which intersect at some point and become a single linked list. The head or start pointers of both the lists are known, but the intersecting node and lengths of lists are not known. What is worst case time complexity of optimal algorithm to find intersecting node from two intersecting linked lists?

  • A. O(n*m), where m, n are lengths of given lists
  • B. O(n^2), where m>n and m, n are lengths of given lists
  • C. O(m+n), where m, n are lengths of given lists
  • D. O(min(n, m)), where m, n are lengths of given lists

9) In a doubly linked list, the number of pointers affected for an insertion operation will be

  • A. 4
  • B. 0
  • C. 1
  • D. None Of These

10) Which one of the following is an application of Stack Data Structure?

  • A. Managing function calls
  • B. The stock span problem
  • C. Arithmetic expression evaluation
  • D. All are Correct

11) To evaluate an expression without any embedded function calls:

  • A. One stack is enough
  • B. Two stacks are needed
  • C. As many stacks as the height of the expression tree are needed
  • D. A Turing machine is needed in the general case

12) How many stacks are needed to implement a queue. Consider the situation where no other data structure like arrays, linked list is available to you.

  • A. 2
  • B. 1
  • C. 3
  • D. 4

13) A queue is implemented using an array such that ENQUEUE and DEQUEUE operations are performed efficiently. Which one of the following statements is CORRECT (n refers to the number of items in the queue)?

  • A. Both operations can be performed in O(1) time
  • B. At most one operation can be performed in O(1) time but the worst case time for the other operation will be ?(n)
  • C. The worst case time complexity for both operations will be ?(n)
  • D. Worst case time complexity for both operations will be ?(log n)

14) The minimum number of stacks needed to implement a queue is

  • A. 1
  • B. 3
  • C. 2
  • D. 4

15) The maximum number of binary trees that can be formed with three unlabeled nodes is:

  • A. 1
  • B. 5
  • C. 4
  • D. 3

16) The number of structurally different possible binary trees with 4 nodes is

  • A. 14
  • B. 336
  • C. 12
  • D. 168

17) A strictly binary tree with 10 leaves

  • A. has exactly 19 nodes
  • B. has exactly 17 nodes
  • C. cannot have more than 19 node
  • D. has exactly 20 nodes

18) Which of the following traversal outputs the data in sorted order in a BST?

  • A. Preorder
  • B. Inorder
  • C. Postorder
  • D. Level order

19) Suppose the numbers 7, 5, 1, 8, 3, 6, 0, 9, 4, 2 are inserted in that order into an initially empty binary search tree. The binary search tree uses the usual ordering on natural numbers. What is the in-order traversal sequence of the resultant tree?

  • A. 7 5 1 0 3 2 4 6 8 9
  • B. 7 5 1 0 3 2 4 6 8 9
  • C. 0 1 2 3 4 5 6 7 8 9
  • D. 9 8 6 4 2 3 0 1 5 7

20) What is the maximum height of any AVL-tree with 7 nodes? Assume that the height of a tree with a single node is 0.

  • A. 3
  • B. 4
  • C. 5
  • D. 2

21) Which of the following is a self-adjusting or self-balancing Binary Search Tree

  • A. Splay Tree
  • B. AVL Tree
  • C. Red Black Tree
  • D. All are Correct

22) How many undirected graphs (not necessarily connected) can be constructed out of a given set V= {V 1, V 2,...V n} of n vertices ?

  • A. n!
  • B. 2^n
  • C. 2^(n(n-1)/2)
  • D. n(n-l)/2

23) Given an undirected graph G with V vertices and E edges, the sum of the degrees of all vertices is

  • A. E
  • B. 2E
  • C. V
  • D. 2V

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

  • A. 80
  • B. 0.0125
  • C. 8000
  • D. 1.25

25) If there's no base criteria in a recursive program, the program will

  • A. not be executed.
  • B. execute until all conditions match.
  • C. execute infinitely.
  • D. obtain progressive approach.

26) The postfix form of the expression (A+ B)*(C*D- E)*F / G is?

  • A. AB+ CD*E - FG /**
  • B. AB + CD* E -*F *G /
  • C. AB + CD* E -F **G /
  • D. AB + CDE * -* F *G /

27) A data structure in which elements can be inserted or deleted at/from both the ends but not in the middle is?

  • A. Queue
  • B. Circular queue
  • C. Dequeue
  • D. Priority queue

28) Which of the following is non-liner data structure?

  • A. List
  • B. Trees
  • C. Stacks
  • D. Strings

29) Which of the following is true about linked list implementation of queue?

  • A. In push operation, if new nodes are inserted at the beginning of linked list, then in pop operation, nodes must be removed from end
  • B. In push operation, if new nodes are inserted at the beginning, then in pop operation, nodes must be removed from the beginning
  • C. In push operation, if new nodes are inserted at the end, then in pop operation, nodes must be removed from end
  • D. In push operation, if new nodes are inserted at the end, then in pop operation, nodes must be removed from beginning.

30) What would be the asymptotic time complexity to add a node at the end of singly linked list, if the pointer is initially pointing to the head of the list?

  • A. O(1)
  • B. O(n)
  • C. ?(n)
  • D. ?(1)

Leave A Comment :

Valid name is required.

Valid name is required.

Valid email id is required.

Related MCQ/Quiz

Appium MCQ