WorksheetsQuiz on Search Algorithms
Total questions: 40
Worksheet time: 20mins
What data structure is used in BFS?
Stack
Queue
Linked List
Tree
Which of the following is true for BFS?
It uses LIFO structure
It may not find the shortest path
It explores all nodes at one depth before moving to the next
It is faster than DFS
BFS is optimal when:
All actions have the same cost
Graph has cycles
Goal node is far
Nodes have variable cost
BFS is a type of:
Informed search
Blind search
Heuristic search
Local search
Which traversal guarantees the shortest path in unweighted graphs?
DFS
A*
UCS
BFS
What data structure is used in DFS?
Queue
Stack
Heap
Array
DFS is not guaranteed to find the optimal path because:
It is incomplete
It explores the deepest path first
It uses heuristics
It doesn’t store visited nodes
Which of these is most memory-efficient?
BFS
DFS
A*
UCS
DFS may get stuck in:
Heuristics
Infinite loops in cyclic graphs
Sorting
Memory issues
DFS is suitable when:
Shallow solutions are preferred
Deep solutions are needed
Heuristics are used
Uniform cost is important
In DLS, a major problem can occur if:
The limit is too high
The limit is too low
It uses a queue
It doesn't mark visited nodes
Depth-limited search prevents:
High memory usage
Infinite loops
Optimal path
All of the above
What happens if the goal is beyond the depth limit in DLS?
Goal is found
Complete path is returned
Failure is returned
Best effort is shown
DLS is a variant of:
BFS
DFS
UCS
A*
Depth-limited search uses which approach?
Iterative
Recursive
Breadth-wise
Depth-wise with cutoff
IDDFS combines the benefits of:
DFS and A*
BFS and DFS
UCS and Greedy
Best-first and DLS
Why is IDDFS preferred over DFS?
It uses heuristics
It avoids getting stuck in infinite paths
It is faster
It doesn't repeat nodes
IDDFS is complete and optimal when:
Path cost is uniform
Goal is at maximum depth
Heuristics are present
Stack is used
In IDDFS, which search is performed repeatedly?
DFS with increasing depth limit
BFS with different strategies
Greedy at each level
UCS multiple times
Which of the following consumes less memory like DFS and is complete like BFS?
UCS
A*
IDDFS
DLS
UCS expands nodes based on:
Depth
Cost so far
Heuristics
Number of steps
Which data structure is used in UCS?
Queue
Stack
Priority queue
Hash table
UCS guarantees:
Fastest path
Shortest path
Least number of nodes
Deepest solution
UCS can be inefficient when:
Path cost varies
Costs are equal
Many paths have same cost
All of the above
UCS is a variant of:
A*
Greedy Search
BFS
DFS
A uses which formula?
f(n) = g(n)
f(n) = h(n)
f(n) = g(n) + h(n)
f(n) = g(n) * h(n)
In A, h(n) represents:
Total cost
Actual cost so far
Estimated cost to goal
Depth
A is complete and optimal if:
h(n) is admissible
g(n) is ignored
Heuristic is random
Goal is deep
A major drawback of A is:
It is incomplete
It doesn’t use heuristics
High memory requirement
It is slow
Which search algorithm guarantees both completeness and optimality using heuristics?
DFS
UCS
A*
Best-first
Best-first search selects node based on:
Path cost
Heuristic only
Depth
Random choice
Best-first search may not be optimal because:
It doesn’t use heuristics
It ignores path cost
It’s slow
It uses backtracking
Best-first search uses which data structure?
Stack
Queue
Priority queue
Array
What happens if the heuristic in Best-first is poor?
Faster performance
Poor path choices
No solution
Optimal result
Best-first search is a type of:
Informed search
Uninformed search
Local search
Recursive search
TSP belongs to which complexity class?
P
NP
NP-Complete
Recursive
What is the goal of TSP?
Visit maximum cities
Maximize path
Minimize distance visiting all cities once
Find the shortest path between two cities
Which technique is commonly used to solve TSP approximately?
DFS
Greedy
Genetic algorithms
A*
TSP is important in which domain?
Web browsing
Routing and logistics
File compression
Cloud computing
If a salesman wants to return to starting city after visiting all cities with minimum cost, it is:
Shortest path problem
TSP
Graph coloring
Cycle detection
