0% found this document useful (0 votes)
167 views15 pages

DSA MCQs For Placement

The document provides a comprehensive list of 80 multiple-choice questions (MCQs) on Data Structures and Algorithms (DSA) that are commonly asked in placement interviews. Each question is accompanied by its answer and covers a wide range of topics including arrays, strings, linked lists, stacks, queues, trees, graphs, sorting, searching, recursion, complexity, and hashing. The questions are designed to test fundamental concepts and practical knowledge in DSA.

Uploaded by

SUTARIYA TULASI
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
167 views15 pages

DSA MCQs For Placement

The document provides a comprehensive list of 80 multiple-choice questions (MCQs) on Data Structures and Algorithms (DSA) that are commonly asked in placement interviews. Each question is accompanied by its answer and covers a wide range of topics including arrays, strings, linked lists, stacks, queues, trees, graphs, sorting, searching, recursion, complexity, and hashing. The questions are designed to test fundamental concepts and practical knowledge in DSA.

Uploaded by

SUTARIYA TULASI
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

DSA MCQs for placement

give 80 MCQ of DSA which are most asked in the placement with answer that cover all the topic
and most important
note: Give ALL THE QUESTION OF THE MCQ WITH ANSWER

Here are 80 important MCQs (with answers) on Data Structures and Algorithms (DSA) that are
frequently asked in campus placements.
These cover Arrays, Strings, Linked List, Stack, Queue, Trees, Graphs, Sorting, Searching, Recursion,
Complexity, and Hashing.

DSA MCQs for Placements (80 Questions with Answers)

1. Which data structure uses LIFO (Last In First Out) principle?

A) Queue
B) Stack
C) Linked List
D) Heap
Answer: B) Stack

2. Which data structure uses FIFO (First In First Out) principle?

A) Stack
B) Queue
C) Tree
D) Graph
Answer: B) Queue

3. What is the time complexity of binary search in a sorted array?

A) O(n)
B) O(log n)
C) O(n log n)
D) O(1)
Answer: B) O(log n)

4. Which sorting algorithm has the best average-case time complexity?

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 1/15
A) Bubble Sort
B) Insertion Sort
C) Merge Sort
D) Selection Sort
Answer: C) Merge Sort

5. What is the worst-case time complexity of Quick Sort?

A) O(n log n)
B) O(log n)
C) O(n²)
D) O(n)
Answer: C) O(n²)

6. Which data structure is used to implement recursion?

A) Array
B) Stack
C) Queue
D) Graph
Answer: B) Stack

7. Which of the following operations is not O(1) in an array?

A) Accessing an element by index


B) Inserting at the end
C) Inserting in the middle
D) Updating a value by index
Answer: C) Inserting in the middle

8. Which traversal is used to get data in sorted order from a Binary Search Tree?

A) Preorder
B) Postorder
C) Inorder
D) Level order
Answer: C) Inorder

9. What is the maximum number of nodes in a binary tree of height h?

A) 2^h - 1
B) 2h - 1
C) h^2
D) 2^(h-1)
Answer: A) 2^h - 1

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 2/15
10. Which algorithm is best for finding the shortest path in a weighted graph with
non-negative edges?

A) BFS
B) DFS
C) Dijkstra’s algorithm
D) Kruskal’s algorithm
Answer: C) Dijkstra’s algorithm

11. What is the time complexity of traversing a linked list of n nodes?

A) O(1)
B) O(log n)
C) O(n)
D) O(n log n)
Answer: C) O(n)

12. Which data structure is ideal for implementing undo operations?

A) Queue
B) Stack
C) Linked List
D) Heap
Answer: B) Stack

13. In which data structure does each element have a pointer to the next element
only?

A) Doubly Linked List


B) Singly Linked List
C) Circular Linked List
D) Skip List
Answer: B) Singly Linked List

14. What is the time complexity to insert an element in a max heap?

A) O(1)
B) O(log n)
C) O(n)
D) O(n log n)
Answer: B) O(log n)

15. Breadth First Search (BFS) uses which data structure?

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 3/15
A) Stack
B) Queue
C) Linked List
D) Tree
Answer: B) Queue

16. Depth First Search (DFS) uses which data structure?

A) Queue
B) Stack
C) Linked List
D) Hash table
Answer: B) Stack

17. Which of these is NOT a stable sorting algorithm?

A) Merge Sort
B) Bubble Sort
C) Quick Sort
D) Insertion Sort
Answer: C) Quick Sort

18. Which data structure is used for implementing priority queues?

A) Stack
B) Heap
C) Queue
D) Linked List
Answer: B) Heap

19. What is the auxiliary space complexity of merge sort?

A) O(1)
B) O(log n)
C) O(n)
D) O(n log n)
Answer: C) O(n)

20. What is the best-case time complexity of insertion sort?

A) O(n)
B) O(log n)
C) O(n²)
D) O(n log n)
Answer: A) O(n)

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 4/15
21. Which hashing technique resolves collisions by using linked lists?

A) Open addressing
B) Separate chaining
C) Double hashing
D) Rehashing
Answer: B) Separate chaining

22. Which search algorithm works on both arrays and linked lists?

A) Linear Search
B) Binary Search
C) Jump Search
D) Interpolation Search
Answer: A) Linear Search

23. Which graph traversal technique is used to detect cycles in a graph?

A) BFS
B) DFS
C) Dijkstra’s algorithm
D) Kruskal’s algorithm
Answer: B) DFS

24. What is the worst-case time complexity of searching in a hash table?

A) O(1)
B) O(n)
C) O(log n)
D) O(n log n)
Answer: B) O(n)

25. Which data structure is used to evaluate postfix expressions?

A) Queue
B) Stack
C) Heap
D) Tree
Answer: B) Stack

26. Which of these is an example of a divide and conquer algorithm?

A) Merge Sort
B) Quick Sort

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 5/15
C) Binary Search
D) All of the above
Answer: D) All of the above

27. Which operation is expensive in a singly linked list compared to an array?

A) Insertion at the beginning


B) Traversal
C) Access by index
D) Deletion from the beginning
Answer: C) Access by index

28. What is the minimum number of edges in a connected graph with n vertices?

A) n
B) n-1
C) 2n
D) n+1
Answer: B) n-1

29. Which traversal is also called level-order traversal?

A) Preorder
B) Postorder
C) BFS
D) DFS
Answer: C) BFS

30. What is the time complexity of heap sort?

A) O(n)
B) O(n log n)
C) O(n²)
D) O(log n)
Answer: B) O(n log n)

31. What is the worst-case time complexity of linear search?

A) O(log n)
B) O(n)
C) O(n log n)
D) O(1)
Answer: B) O(n)

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 6/15
32. Which of these can be implemented using two stacks?

A) Heap
B) Queue
C) Graph
D) Tree
Answer: B) Queue

33. The in-order traversal of a BST always gives elements in:

A) Descending order
B) Ascending order
C) Random order
D) Level-wise order
Answer: B) Ascending order

34. Which data structure supports efficient range queries?

A) Linked List
B) Segment Tree
C) Queue
D) Stack
Answer: B) Segment Tree

35. Which algorithm finds the Minimum Spanning Tree (MST)?

A) Dijkstra’s algorithm
B) Kruskal’s algorithm
C) BFS
D) DFS
Answer: B) Kruskal’s algorithm

36. Which of the following is a balanced binary search tree?

A) B-Tree
B) AVL Tree
C) Red-Black Tree
D) All of the above
Answer: D) All of the above

37. What is the time complexity of push and pop in a stack?

A) O(1)
B) O(n)
C) O(log n)

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 7/15
D) O(n log n)
Answer: A) O(1)

38. Which of the following is not a linear data structure?

A) Queue
B) Stack
C) Linked List
D) Tree
Answer: D) Tree

39. Which data structure is best for implementing LRU cache?

A) Array + Linked List


B) Hash Map + Doubly Linked List
C) Queue only
D) Stack only
Answer: B) Hash Map + Doubly Linked List

40. What is the space complexity of DFS on a graph with V vertices?

A) O(1)
B) O(V)
C) O(log V)
D) O(V+E)
Answer: B) O(V)

41. Which of these trees is height balanced?

A) Binary Search Tree


B) AVL Tree
C) Heap
D) Both B and C
Answer: D) Both B and C

42. Which is not a stable sorting algorithm?

A) Counting Sort
B) Quick Sort
C) Bubble Sort
D) Merge Sort
Answer: B) Quick Sort

43. What is the main advantage of linked list over arrays?

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 8/15
A) Random access
B) Dynamic size
C) Cache friendliness
D) Constant time indexing
Answer: B) Dynamic size

44. Which data structure is used for the Tower of Hanoi problem?

A) Queue
B) Stack
C) Tree
D) Graph
Answer: B) Stack

45. Which is a non-comparison based sorting algorithm?

A) Quick Sort
B) Merge Sort
C) Counting Sort
D) Heap Sort
Answer: C) Counting Sort

46. Which algorithm is used in finding strongly connected components (SCC) in a


graph?

A) BFS
B) Kosaraju’s algorithm
C) Kruskal’s algorithm
D) Dijkstra’s algorithm
Answer: B) Kosaraju’s algorithm

47. Which data structure is ideal for checking balanced parentheses?

A) Queue
B) Stack
C) Linked List
D) Hashing
Answer: B) Stack

48. Which traversal visits root, left subtree, then right subtree?

A) Preorder
B) Postorder
C) Inorder

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 9/15
D) Level order
Answer: A) Preorder

49. What is the time complexity of BFS for a graph with V vertices and E edges?

A) O(V + E)
B) O(V²)
C) O(log V)
D) O(E log V)
Answer: A) O(V + E)

50. Which data structure is used by the operating system for scheduling?

A) Stack
B) Queue
C) Tree
D) Graph
Answer: B) Queue

51. Which data structure uses circular indexing?

A) Queue
B) Circular Queue
C) Deque
D) Stack
Answer: B) Circular Queue

52. Which type of linked list allows traversal in both directions?

A) Singly Linked List


B) Doubly Linked List
C) Circular Linked List
D) None
Answer: B) Doubly Linked List

53. Which searching algorithm is best for sorted linked lists?

A) Linear search
B) Binary search
C) Hashing
D) None
Answer: A) Linear search

54. Which sorting algorithm is best for small datasets?

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 10/15
A) Bubble Sort
B) Insertion Sort
C) Merge Sort
D) Heap Sort
Answer: B) Insertion Sort

55. Which traversal order is used for expression tree evaluation?

A) Preorder
B) Postorder
C) Inorder
D) Level order
Answer: B) Postorder

56. Which algorithm is used to detect negative weight cycles in a graph?

A) BFS
B) Bellman-Ford
C) Dijkstra
D) Floyd Warshall
Answer: B) Bellman-Ford

57. In an adjacency matrix representation of a graph, space complexity is:

A) O(V+E)
B) O(V²)
C) O(E²)
D) O(V)
Answer: B) O(V²)

58. Which graph algorithm is used for topological sorting?

A) BFS
B) DFS
C) Kruskal
D) Prim
Answer: B) DFS

59. Which data structure allows insertion and deletion at both ends?

A) Queue
B) Deque
C) Stack
D) Linked List
Answer: B) Deque

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 11/15
60. Which data structure is used for memory management in compilers?

A) Queue
B) Stack
C) Linked List
D) Graph
Answer: B) Stack

61. The height of a balanced binary tree with n nodes is:

A) O(n)
B) O(log n)
C) O(1)
D) O(n log n)
Answer: B) O(log n)

62. Which data structure can implement a BFS without recursion?

A) Stack
B) Queue
C) Linked List
D) Array
Answer: B) Queue

63. What is the worst-case time complexity of Merge Sort?

A) O(n²)
B) O(n log n)
C) O(log n)
D) O(n)
Answer: B) O(n log n)

64. In a min-heap, the root node contains:

A) Maximum value
B) Minimum value
C) Average value
D) Random value
Answer: B) Minimum value

65. Which tree traversal is used in converting an expression tree to postfix?

A) Preorder
B) Postorder

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 12/15
C) Inorder
D) BFS
Answer: B) Postorder

66. Which algorithm is used to detect articulation points in a graph?

A) Tarjan’s algorithm
B) Prim’s algorithm
C) Kruskal’s algorithm
D) Floyd Warshall
Answer: A) Tarjan’s algorithm

67. Which data structure is efficient for implementing undo/redo features?

A) Stack
B) Queue
C) Linked List
D) Graph
Answer: A) Stack

68. Which of these trees has all leaves at the same level?

A) Binary Tree
B) Full Binary Tree
C) Complete Binary Tree
D) Perfect Binary Tree
Answer: D) Perfect Binary Tree

69. In a binary search tree, left child is always:

A) Greater than root


B) Smaller than root
C) Equal to root
D) None
Answer: B) Smaller than root

70. Which is the best case time complexity of bubble sort?

A) O(n²)
B) O(n)
C) O(log n)
D) O(n log n)
Answer: B) O(n)

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 13/15
71. Which graph algorithm works for both directed and undirected graphs?

A) BFS
B) DFS
C) Dijkstra
D) All of the above
Answer: D) All of the above

72. Which hashing method handles collisions by probing?

A) Separate chaining
B) Open addressing
C) Double hashing
D) Hash chaining
Answer: B) Open addressing

73. Which data structure supports constant-time insertion and deletion at both
ends?

A) Deque
B) Queue
C) Stack
D) Linked List
Answer: A) Deque

74. What is the auxiliary space complexity of quick sort?

A) O(1)
B) O(log n)
C) O(n)
D) O(n log n)
Answer: B) O(log n)

75. Which of the following can be used for cycle detection in a linked list?

A) BFS
B) DFS
C) Floyd’s Tortoise and Hare algorithm
D) Bellman Ford
Answer: C) Floyd’s Tortoise and Hare algorithm

76. Which algorithm is used to find a Minimum Spanning Tree?

A) Prim’s algorithm
B) Kruskal’s algorithm

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 14/15
C) Boruvka’s algorithm
D) All of these
Answer: D) All of these

77. Which is NOT a characteristic of a heap?

A) Complete binary tree


B) Every parent node is greater (max-heap)
C) In-order traversal gives sorted output
D) Random structure
Answer: C) In-order traversal gives sorted output

78. Which data structure helps in implementing function calls?

A) Queue
B) Stack
C) Graph
D) Array
Answer: B) Stack

79. Which is used for backtracking algorithms?

A) Queue
B) Stack
C) Heap
D) Tree
Answer: B) Stack

80. Which algorithm is used for finding the shortest path in graphs with negative
weights?

A) Dijkstra
B) Bellman-Ford
C) BFS
D) Prim
Answer: B) Bellman-Ford

These 80 MCQs cover all important DSA topics commonly asked in campus placements and
interviews.

Would you like me to

Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 15/15

You might also like