Graph traversal algorithms (DFS, BFS) MCQsBy: Prof. Dr. Fazal Rehman | Last updated: May 15, 2025 20 Score: 0 Attempted: 0/20 Subscribe 1. What does DFS stand for in graph theory? (A) Depth First Search (B) Depth Factor Search (C) Depth Function Search (D) Depth Following Search 2. Which data structure is primarily used in DFS? (A) Queue (B) Stack (C) Array (D) Linked list 3. What does BFS stand for in graph theory? (A) Best First Search (B) Breadth First Search (C) Balanced First Search (D) Broad First Search 4. Which data structure is primarily used in BFS? (A) Stack (B) Queue (C) Array (D) Linked list 5. What is the primary use of DFS? (A) Finding the shortest path (B) Traversing all vertices of a graph (C) Finding connected components (D) Searching for a specific vertex 6. In which traversal method is the root node processed before its children? (A) BFS (B) DFS (C) Both BFS and DFS (D) Neither BFS nor DFS 7. Which traversal method guarantees the shortest path in an unweighted graph? (A) DFS (B) BFS (C) Both DFS and BFS (D) Neither DFS nor BFS 8. What is a key characteristic of BFS? (A) It explores all neighbors before going deeper (B) It uses a stack for exploration (C) It can get stuck in cycles (D) It always finds the longest path 9. In which traversal method is backtracking often used? (A) BFS (B) DFS (C) Both BFS and DFS (D) Neither BFS nor DFS 10. How does BFS handle cycles in a graph? (A) It ignores cycles (B) It gets stuck in an infinite loop (C) It marks visited nodes (D) It does not work with cycles 11. What is the time complexity of BFS on a graph with V vertices and E edges? (A) O(V) (B) O(E) (C) O(V + E) (D) O(V * E) 12. What is the time complexity of DFS on a graph with V vertices and E edges? (A) O(V) (B) O(E) (C) O(V + E) (D) O(V * E) 13. Which traversal method is more memory-efficient for wide graphs? (A) DFS (B) BFS (C) Both have the same efficiency (D) None of the above 14. What is the space complexity of BFS? (A) O(V) (B) O(E) (C) O(V + E) (D) O(1) 15. Which algorithm can be implemented using DFS? (A) Topological sorting (B) Prim’s algorithm (C) Dijkstra’s algorithm (D) Kruskal’s algorithm 16. Which algorithm can be implemented using BFS? (A) Finding connected components (B) Topological sorting (C) Shortest path in unweighted graphs (D) Minimum spanning tree 17. What is the initial step in a BFS traversal? (A) Mark all nodes as unvisited (B) Push the starting node onto the stack (C) Enqueue the starting node (D) Start from the deepest node 18. What is the initial step in a DFS traversal? (A) Mark all nodes as unvisited (B) Push the starting node onto the queue (C) Enqueue the starting node (D) Start from the root node 19. In DFS, what happens when a node has no unvisited neighbors? (A) It stops traversing (B) It backtracks to the last visited node (C) It enqueues all neighbors (D) It visits all nodes in the graph 20. What is a possible output of BFS on a tree structure? (A) Left-to-right traversal (B) Top-to-bottom traversal (C) Random order (D) Depth-based traversal Data Structures MCQs Basic Concepts Introduction to Data Structures Abstract Data Types (ADT) MCQs Complexity Analysis MCQs Time complexity MCQs Space complexity MCQs Big O, Big Ω, Big Θ notations MCQs Linear Data Structures MCQs Arrays MCQs One-dimensional arrays MCQs Multi-dimensional arrays MCQs Operations: traversal, insertion, deletion MCQs Linked Lists MCQs Singly linked list MCQs Doubly linked list MCQs Circular linked list MCQs Stacks MCQs Stack operations (push, pop, peek) MCQs Applications of stacks (expression evaluation, recursion) MCQs Queues MCQs Queue operations (enqueue, dequeue, front, rear) MCQs Types: Simple queue, circular queue, priority queue, deque MCQs Non-Linear Data Structures MCQs Trees MCQs Binary trees MCQs Binary Search Trees (BST) MCQs AVL Trees MCQs B-trees and B+ trees MCQs Tree traversal methods (in-order, pre-order, post-order) MCQs Heaps MCQs Min-heap MCQs Max-heap MCQs Heap operations (insertion, deletion, heapify) MCQs Applications of heaps (priority queues, heap sort) MCQs Graphs MCQs Graph representation (adjacency matrix, adjacency list) MCQs Graph traversal algorithms (DFS, BFS) MCQs Shortest path algorithms (Dijkstra’s, Bellman-Ford) MCQs Minimum Spanning Tree (Kruskal’s, Prim’s) MCQs Hashing MCQs MCQs Hash Tables Hash functions MCQs Collision resolution techniques (chaining, open addressing) MCQs Applications of hashing MCQs Sorting and Searching Algorithms MCQs Sorting Algorithms MCQs Bubble sort MCQs Selection sort MCQs Insertion sort MCQs Merge sort MCQs Quick sort MCQs Heap sort MCQs Searching Algorithms MCQs Linear search MCQs Binary search MCQs Interpolation search MCQs Miscellaneous Memory Management in data structures MCQs Dynamic memory allocation MCQs Garbage collection MCQs String Manipulation Algorithms MCQs Pattern matching (KMP, Rabin-Karp) MCQs String hashing MCQs Data Structures MCQs 1 Data Structures MCQs 2 Data Structures MCQs 3 Data Structures MCQs 4 Data Structures MCQs 5 Stacks Solved MCQs Queues MCQs pointer mcqs Array MCQs Related Posts:Graph Algorithms Solved MCQs With AnswersDistributed graph algorithms MCQsOperations: traversal, insertion, deletion MCQsTree traversal methods (in-order, pre-order, post-order) MCQsGraph Theory MCQs | MathGraph Planning MCQs Artificial Intelligence