Data Structures MCQs (Part-7)

Which of the following graph traversal algorithms uses a queue?

A BFS
B A*
C DFS
D Dijkstra

What is the primary advantage of quicksort over merge sort?

A Faster for small arrays
B Stable sorting
C Lower space complexity
D Better worst-case time

Which traversal algorithm is used to find the shortest path in an unweighted graph?

A Dijkstra
B BFS
C Bellman-Ford
D DFS

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

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

Which search algorithm is used to find the shortest path in a weighted graph with non-negative edges?

A BFS
B DFS
C Dijkstra
D A*

Which of the following is true about a depth-first search (DFS)?

A It never backtracks
B It can get stuck in infinite loops
C It always finds a cycle
D It is faster than BFS

Which sorting algorithm is best suited for sorting linked lists?

A Heap Sort
B Merge Sort
C Quick Sort
D Selection Sort

Which of the following is not a property of a BFS traversal?

A It visits nodes level by level
B It is used for finding shortest paths in weighted graphs
C It uses a queue
D It can visit nodes in a random order

Which of the following is a characteristic of the Merge Sort algorithm?

A Time complexity O(n²)
B Recursive
C In-place sorting
D Not stable

Which of the following algorithms is used to detect cycles in a directed graph?

A Bellman-Ford
B DFS
C Dijkstra
D BFS

Which sorting algorithm is based on the divide-and-conquer principle?

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

What is the time complexity of finding the minimum element in a binary heap?

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

Which of the following is true about the Bellman-Ford algorithm?

A It always produces the shortest path
B It can handle graphs with negative weights
C It only works with unweighted graphs
D It is faster than Dijkstra’s algorithm

Which of the following is the correct sequence for quicksort’s operations?

A Partition, Sort, Recursion
B Recursion, Sort, Partition
C Sort, Partition, Recursion
D Partition, Recursion, Sort

Which sorting algorithm performs well when the range of data is small?

A Bubble Sort
B Merge Sort
C Counting Sort
D Quick Sort