1 - Data Structure MCQ

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

DATA STRUCTURES MCQ

1. Which of the following data structures allows rapid search, insertion, and
deletion operations?
a) Array
b) Linked List
c) Hash Table
d) Binary Tree

2. Which data structure follows the Last In First Out (LIFO) principle?
a) Queue
b) Stack
c) Tree
d) Linked List

3. What is the minimum number of queues required to implement a priority


queue?
a) One
b) Two
c) Three
d) Four

4. Which data structure is used in the implementation of a breadth-first


search algorithm?
a) Stack
b) Queue
c) Heap
d) Linked List

5. Which of the following data structures uses dynamic memory allocation?


(a) Array
(b) Linked List
(c) Stack
(d) Queue
DATA STRUCTURES MCQ
6. A doubly linked list allows efficient:
(a) Insertion at the beginning only
(b) Insertion and deletion at any position
(c) Search from the beginning
(d) Random access

7. What is the space complexity of a singly linked list representation of a


stack?
(a) O(1)
(b) O(n)
(c) O(log n)
(d) O(n^2)

8. The Floyd-Warshall algorithm is used for:


(a) Finding shortest paths between all pairs of vertices in a directed
graph
(b) Finding Eulerian circuits in a graph
(c) Detecting cycles in a graph
(d) Topological sorting of a directed acyclic graph

9. What is the best-case time complexity of binary search for an element in


a sorted array?
(a) O(1)
(b) O(log n)
(c) O(n)
(d) O(n^2)

10. What is the worst-case time complexity of binary search for an element
in a sorted array?
(a) O(1)
(b) O(log n)
(c) O(n)
(d) O(n^2)
DATA STRUCTURES MCQ
11)Which data structure is typically used to implement a First In First Out
(FIFO) queue?
(a) Array
(b) Linked List
(c) Stack
(d) Hash Table

Answer: (b) Linked List

12) In a binary search tree, which traversal method visits the nodes in
ascending order?
(a) Preorder
(b) Inorder
(c) Postorder
(d) Level order

Answer: (b) Inorder

13) Which data structure is commonly used to implement a heap?


(a) Array
(b) Linked List
(c) Hash Table
(d) Binary Tree

Answer: (a) Array

14) Which of the following is not a type of tree traversal?


(a) Depth-first
(b) Breadth-first
(c) Height-first
(d) Level-order

Answer: (c) Height-first


DATA STRUCTURES MCQ
15) What is the time complexity of finding the maximum element in a binary
search tree?
(a) O(n)
(b) O(log n)
(c) O(n^2)
(d) O(1)

Answer: (a) O(n)

16) Which data structure is used for topological sorting of a directed acyclic
graph (DAG)?
(a) Queue
(b) Stack
(c) Heap
(d) Linked List

Answer: (b) Stack

17) Which data structure is suitable for implementing a cache with Least
Recently Used (LRU) eviction policy?
(a) Array
(b) Linked List
(c) Queue
(d) Stack

Answer: (b) Linked List

18) What is the worst-case time complexity for searching an element in a


hash table with chaining collision resolution?
(a) O(1)
(b) O(log n)
(c) O(n)
(d) O(n^2)
DATA STRUCTURES MCQ
Answer: (c) O(n)

19) Which data structure is used in the implementation of Dijkstra's shortest


path algorithm?
(a) Queue
(b) Stack
(c) Heap
(d) Linked List

20) Which data structure is typically used for implementing a symbol table
in compilers?
(a) Hash Table
(b) Binary Search Tree
(c) Linked List

21. Which data structure is commonly used for implementing undo


functionality in text editors?
(A) Stack
(B) Queue
(C) Linked List
(D) Binary Tree

22. What is the time complexity of inserting an element at the end of a


singly linked list with tail pointer?
(A) O(1)
(B) O(log n)
(C) O(n)
(D) O(n^2)
DATA STRUCTURES MCQ
23. Which data structure is used for implementing the "undo" operation in a
graphics drawing program?
(A) Queue
(B) Stack
(C) Linked List
(D) Binary Tree

24. In a binary tree, the maximum number of nodes at level "k" is:
(A) 2^(k-1)
(B) 2^k
(C) k^2
(D) 2^(k+1) - 1

25. Which data structure is typically used for implementing a Least


Recently Used (LRU) cache?
(A) Array
(B) Linked List
(C) Queue
(D) Stack

26. In which traversal of a binary tree are the nodes processed in the order:
left, root, right?
(A) Preorder
(B) Inorder
(C) Postorder
(D) Level order

27. Which data structure is used for implementing the Open Addressing
strategy in hashing?
(A) Array
DATA STRUCTURES MCQ
(B) Linked List
(C) Queue
(D) Stack

28. What is the time complexity of inserting an element into a binary search
tree?
(A) O(1)
(B) O(log n)
(C) O(n)
(D) O(n^2)

29. Which data structure is used in the implementation of the Kruskal's


minimum spanning tree algorithm?
(A) Queue
(B) Stack
(C) Heap
(D) Linked List

30. Which data structure is used for efficient implementation of Prim's


algorithm for minimum spanning tree?
(A) Queue
(B) Stack
(C) Heap
(D) Linked List

31. The minimum number of fields in each node of a doubly linked list is
____
(A) 2
(B) 3
(C) 4
DATA STRUCTURES MCQ
(D) None of the above

32. A graph in which all vertices have equal degree is known as ____
(A) Complete graph
(B) Regular graph
(C) Multigraph
(D) Simple graph

33. A vertex of in-degree zero in a directed graph is called a/an


(A) Root vertex
(B) Isolated vertex
(C) Sink
(D) Articulation point

34. A graph is a tree if and only if the graph is


(A) Directed graph
(B) Contains no cycles
(C) Planar
(D) Completely connected

35. The elements of a linked list are stored


(A) In a structure
(B) In an array
(C) Anywhere the computer has space for them
(D) In contiguous memory locations

36. A parentheses checker program would be best implemented using


(A) List
(B) Queue
(C) Stack
(D) Any of the above
DATA STRUCTURES MCQ
37. To perform level-order traversal on a binary tree, which of the
the following data structure will be required?
(A) Hash table
(B) Queue
(C) Binary search tree
(D) Stack

38. Which of the following data structures is required to convert


arithmetic expression in infix to its equivalent postfix notation?
(A) Queue
(B) Linked list
(C) Binary search tree
(D) None of the above

39. A binary tree in which all its levels except the last, have maximum
numbers of nodes and all the nodes in the last level have only one
child it will be its left child. Name the tree.
(A) Threaded tree
(B) Complete binary tree
(C) M-way search tree
(D) Full binary tree

40. Which of the following data structures is more appropriate for


implementing quick sort iteratively?
(A) Deque
(B) Queue
(C) Stack
(D) Priority queue

You might also like