0% found this document useful (0 votes)
79 views10 pages

Data Structures & Algorithms MCQs

The document contains 50 multiple-choice questions (MCQs) focused on data structures and algorithms, covering topics such as time complexity, sorting algorithms, tree properties, and graph theory. Each question is followed by an answer key that provides the correct options for all questions. This resource is designed for individuals studying or reviewing concepts in computer science.

Uploaded by

kathir9344853902
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)
79 views10 pages

Data Structures & Algorithms MCQs

The document contains 50 multiple-choice questions (MCQs) focused on data structures and algorithms, covering topics such as time complexity, sorting algorithms, tree properties, and graph theory. Each question is followed by an answer key that provides the correct options for all questions. This resource is designed for individuals studying or reviewing concepts in computer science.

Uploaded by

kathir9344853902
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

Data Structures & Algorithms – 50 MCQs

1. Which data structure works on the principle of FIFO?

A. Stack
B. Queue
C. Tree
D. Graph

2. What is the time complexity of binary search?

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

3. Which of the following is NOT a stable sorting algorithm?

A. Merge Sort
B. Bubble Sort
C. Quick Sort
D. Insertion Sort

4. Which data structure uses LIFO?

A. Queue
B. Tree
C. Stack
D. Graph

5. Which tree is always height-balanced?

A. Binary Search Tree


B. AVL Tree
C. Heap
D. B-Tree

6. Which hashing technique resolves collision by chaining?

A. Open addressing
B. Linear probing
C. Separate chaining
D. Double hashing

7. The worst-case time complexity of Quick Sort is:

A. O(log n)
B. O(n)
C. O(n log n)
D. O(n²)

8. BFS uses which data structure?

A. Stack
B. Queue
C. Tree
D. Graph

9. DFS uses which data structure (implicitly or explicitly)?

A. Queue
B. Stack
C. Heap
D. List

10. What is the height of a complete binary tree with n nodes?

A. log n
B. n
C. n log n
D. √n

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

A. Linked list
B. Array
C. Tree
D. Stack

12. Which structure is used in function call management (call stack)?

A. Queue
B. Heap
C. Stack
D. Graph

13. In a min-heap, the smallest element is stored at:

A. Last node
B. Root
C. Middle
D. Any leaf

14. Which sorting algorithm has the best average-case efficiency?


A. Bubble sort
B. Quick Sort
C. Insertion Sort
D. Selection Sort

15. Which data structure is used for implementing recursion?

A. Queue
B. Array
C. Stack
D. Heap

16. A full binary tree with n internal nodes has how many leaves?

A. n
B. n + 1
C. 2n
D. 2n + 1

17. Which of the following traversals is in-order for a BST?

A. Sorted order
B. Reverse sorted
C. Random
D. Level order

18. What is the time complexity of inserting an element in a linked list at the
beginning?

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

19. Which tree always remains perfectly balanced?

A. Splay Tree
B. Red-Black Tree
C. AVL Tree
D. Binary Search Tree

20. Which algorithm is used to find the shortest path in a weighted graph?

A. DFS
B. BFS
C. Dijkstra’s algorithm
D. Kruskal’s algorithm
21. Which algorithm is used for Minimum Spanning Tree?

A. Dijkstra
B. Kruskal
C. BFS
D. A*

22. Which of the following is not an in-place sorting algorithm?

A. Quick Sort
B. Bubble Sort
C. Merge Sort
D. Heap Sort

23. The worst-case time complexity of Bubble Sort is:

A. O(n)
B. O(log n)
C. O(n²)
D. O(n log n)

24. Which tree traversal uses a queue?

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

25. Which of these is used to detect a cycle in a graph?

A. BFS
B. DFS
C. Dijkstra
D. Prim’s

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

A. Insertion Sort
B. Merge Sort
C. Selection Sort
D. Bubble Sort

27. A priority queue is usually implemented using:

A. Stack
B. Queue
C. Heap
D. Linked list
28. Which of these does NOT require contiguous memory?

A. Array
B. Linked List
C. Matrix
D. String

29. Which of these can be used to implement a graph?

A. Adjacency list
B. Adjacency matrix
C. Both A and B
D. None

30. What is the space complexity of Merge Sort?

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

31. Which of these has the fastest lookup time on average?

A. Array
B. Linked List
C. Hash Table
D. Stack

32. Which algorithm is used for topological sorting?

A. BFS/DFS
B. Dijkstra
C. Prim
D. Kruskal

33. Which operation is fastest in a linked list as compared to an array?

A. Access by index
B. Searching
C. Insertion at beginning
D. None

34. The number of edges in a complete graph with n vertices is:

A. n
B. n²
C. n(n−1)/2
D. 2n
35. Which of these algorithms is comparison-based?

A. Counting sort
B. Radix sort
C. Bucket sort
D. Merge sort

36. In a BST, searching takes:

A. O(1)
B. O(log n) average
C. O(n log n)
D. O(n²)

37. Which data structure is used in Dijkstra’s algorithm?

A. Stack
B. Queue
C. Priority queue
D. Tree

38. Which algorithm is optimal for finding MST in dense graphs?

A. Kruskal
B. Prim (with adjacency matrix)
C. Dijkstra
D. BFS

39. Which tree ensures O(log n) time for search, insert, delete?

A. BST
B. AVL Tree
C. Graph
D. Hash Table

40. Time complexity for push() in a stack using array:

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

41. A graph that has no cycles is known as:

A. DAG
B. Complete graph
C. Bipartite graph
D. Tree
42. Which is used to evaluate postfix expressions?

A. Queue
B. Stack
C. Heap
D. Tree

43. The maximum number of nodes in a height h binary tree is:

A. h
B. 2^h
C. 2^(h+1) − 1
D. h²

44. Which algorithm is used for scheduling problems?

A. BFS
B. Kruskal
C. Greedy algorithms
D. Dynamic programming

45. Which of these is NOT a greedy algorithm?

A. Dijkstra
B. Kruskal
C. Huffman coding
D. Merge Sort

46. The best-case time of Quick Sort occurs when:

A. Pivot is smallest
B. Pivot is largest
C. Pivot is median
D. Pivot is random

47. Which data structure is useful for undo operations?

A. Queue
B. Array
C. Stack
D. Heap

48. The minimum height of a red–black tree with n nodes is:

A. log n
B. 2 log n
C. n
D. √n
49. What is the in-order successor of a node in BST?

A. Maximum of right subtree


B. Minimum of right subtree
C. Root
D. Parent

50. Which sorting algorithm is best for nearly sorted data?

A. Bubble Sort
B. Merge Sort
C. Insertion Sort
D. Quick Sort

MCQs with Answer Key

1. B

2. B

3. C

4. C

5. B

6. C

7. D

8. B

9. B

10. A

11. C

12. C

13. B

14. B

15. C

16. B
17. A

18. A

19. C

20. C

21. B

22. C

23. C

24. D

25. B

26. B

27. C

28. B

29. C

30. C

31. C

32. A

33. C

34. C

35. D

36. B

37. C

38. B

39. B

40. A

41. A

42. B

43. C

44. C
45. D

46. C

47. C

48. A

49. B

50. C

You might also like