GATE Previous Year Questions — Uninformed Search

GATE Relevance: High

Prerequisites

🎯 Learning Objectives

  • Practice with authentic GATE-style problems on uninformed search
  • Master the step-by-step trace technique for exam questions
  • Identify common traps and distractors in search strategy questions
  • Build speed and accuracy for the 2-mark MCQ and NAT formats

This page contains 10 carefully curated GATE-style questions that test the most frequently examined concepts in uninformed search. Each question includes a detailed solution walkthrough and a key takeaway for exam preparation.

Question 1 — BFS Node Expansion Count

📝 Problem Statement (MCQ — 2 marks)

Consider a search tree with branching factor b = 3 and the goal node at depth d = 3. BFS expands nodes level by level. Assuming that the goal is the last node generated at depth 3, how many nodes does BFS expand (i.e., remove from the frontier and generate successors for) before finding the goal?

Options:

  1. 13
  2. 39
  3. 40
  4. 121
✅ Detailed Solution

Key insight: BFS tests for the goal when a node is generated (added to the frontier), not when it is expanded. However, the question asks how many nodes are expanded.

  • Depth 0: Expand root → 1 node expanded, generates 3 children.
  • Depth 1: Expand all 3 nodes → 3 nodes expanded, generates 9 children.
  • Depth 2: Expand all 9 nodes → 9 nodes expanded, generates 27 children at depth 3.

Total nodes expanded = 1 + 3 + 9 = 13. The goal is the last node at depth 3, but with early goal test, BFS identifies it upon generation without expanding it.

Answer: A. 13

Key Takeaway: BFS with early goal test expands all nodes at depths 0 through d−1 = (bd − 1) / (b − 1). With b=3, d=3: (27−1)/2 = 13.

Question 2 — DFS Traversal Order

📝 Problem Statement (MCQ — 1 mark)

Consider the following tree where children are expanded left-to-right:

         A
       / | \
      B  C  D
     /\    /\
    E  F  G  H
       |
       I

What is the order in which nodes are visited (expanded) by DFS?

Options:

  1. A, B, E, F, I, C, D, G, H
  2. A, B, C, D, E, F, G, H, I
  3. A, B, E, F, I, D, G, H, C
  4. A, D, H, G, C, B, F, I, E
✅ Detailed Solution

DFS uses a LIFO stack. With left-to-right expansion:

  1. Expand A → push D, C, B (B on top).
  2. Expand B → push F, E (E on top).
  3. Expand E → no children. Pop next: F.
  4. Expand F → push I.
  5. Expand I → no children. Pop next: C.
  6. Expand C → no children. Pop next: D.
  7. Expand D → push H, G (G on top).
  8. Expand G → no children. Pop next: H.
  9. Expand H → done.

Order: A, B, E, F, I, C, D, G, H → Answer: A

Key Takeaway: When tracing DFS, push children in reverse order onto the stack so the leftmost child is on top. Alternatively, think recursively: always go to the deepest leftmost unexplored node first.

Question 3 — BFS vs DFS Space Complexity (NAT)

📝 Problem Statement (NAT — 2 marks)

A search tree has branching factor b = 4 and the solution is at depth d = 5. The maximum depth of the tree is m = 10.

What is the ratio of BFS frontier size to DFS frontier size at their respective worst cases? Express as an integer (round to the nearest whole number).

Use: BFS space = O(bd), DFS space = O(b · m).

✅ Detailed Solution

BFS worst-case frontier: bd = 45 = 1024.

DFS worst-case frontier: b · m = 4 × 10 = 40.

Ratio = 1024 / 40 = 25.6 ≈ 26.

Answer: 26

Key Takeaway: This dramatic difference is why DFS (and IDDFS) are preferred when memory is the bottleneck. BFS space grows exponentially with depth, while DFS grows only linearly.

Question 4 — IDDFS Total Nodes Generated

📝 Problem Statement (NAT — 2 marks)

Iterative Deepening DFS is run on a tree with branching factor b = 2. The goal is at depth d = 4. How many total nodes are generated across all iterations (depth limits 0, 1, 2, 3, 4)? Assume the goal is found at the last node of depth 4.

Hint: Nodes at depth k in a uniform tree = bk. IDDFS with limit L generates nodes at depths 0, 1, …, L.

✅ Detailed Solution

IDDFS runs DLS for limits 0, 1, 2, 3, 4. Each DLS(limit=L) generates all nodes at depths 0 through L.

Nodes generated in a complete tree at depth k with b=2: 2k.

Total nodes per DLS iteration (sum of all levels 0 to L) = 20 + 21 + … + 2L = 2L+1 − 1.

Limit LNodes generated
021 − 1 = 1
122 − 1 = 3
223 − 1 = 7
324 − 1 = 15
425 − 1 = 31

Total = 1 + 3 + 7 + 15 + 31 = 57

Answer: 57

Key Takeaway: The overhead of IDDFS is modest. Compare with a single BFS run generating 25 − 1 = 31 nodes. IDDFS generates 57/31 ≈ 1.84× as many — close to the theoretical overhead of b/(b−1) = 2 for b=2. For b=10, overhead drops to just ~11%.

Question 5 — Uniform Cost Search Path

📝 Problem Statement (MCQ — 2 marks)

Consider the following weighted graph. UCS starts at node S and the goal is G.

    S --1-- A --5-- G
    |              ^
    3              |
    |              2
    B ------4----- C

Edges: S→A (cost 1), A→G (cost 5), S→B (cost 3), B→C (cost 4), C→G (cost 2).

What path does UCS find and what is its cost?

  1. S → A → G, cost 6
  2. S → B → C → G, cost 9
  3. S → A → G, cost 5
  4. S → B → G, cost 7
✅ Detailed Solution

UCS uses a priority queue ordered by path cost g(n).

  1. Init: Frontier = {S: 0}.
  2. Expand S (cost 0): Add A (cost 1) and B (cost 3). Frontier = {A:1, B:3}.
  3. Expand A (cost 1): Add G (cost 1+5=6). Frontier = {B:3, G:6}.
  4. Expand B (cost 3): Add C (cost 3+4=7). Frontier = {G:6, C:7}.
  5. Expand G (cost 6): Goal found!

Path: S → A → G, cost = 6.

Note: The alternative path S → B → C → G has cost 3+4+2 = 9, which is more expensive.

Answer: A. S → A → G, cost 6

Key Takeaway: UCS always expands the node with the lowest path cost first, guaranteeing optimality. Even though S→B looks cheaper initially (cost 3 vs. 1+5), UCS evaluates total path cost, not just the first step.

Question 6 — Completeness of Search Strategies

📝 Problem Statement (MCQ — 1 mark)

Which of the following uninformed search strategies is NOT complete even in a finite state space?

  1. Breadth-First Search
  2. Uniform Cost Search (with ε > 0 step costs)
  3. Depth-First Search (tree search, no cycle detection)
  4. Iterative Deepening DFS
✅ Detailed Solution

DFS with tree search and no cycle detection can get stuck in an infinite loop, even in a finite state space, if there are repeated states (e.g., A→B→A→B…). This makes it incomplete.

  • BFS: Complete (finite b) ✅
  • UCS: Complete (if step costs ≥ ε > 0) ✅
  • DFS (tree search): Not complete (infinite loops) ❌
  • IDDFS: Complete (same as BFS guarantee) ✅

Answer: C. Depth-First Search

Key Takeaway: DFS is incomplete in two scenarios: (1) infinite-depth paths, (2) loops without cycle detection. GATE often tests whether DFS with graph search (explored set) becomes complete — it does, for finite state spaces.

Question 7 — IDDFS Space Complexity

📝 Problem Statement (MCQ — 1 mark)

What is the space complexity of Iterative Deepening DFS?

  1. O(bd)
  2. O(b · d)
  3. O(b · m)
  4. O(d)
✅ Detailed Solution

IDDFS performs repeated DFS calls with increasing depth limits. At any given iteration with limit L, DFS stores one path from root to a leaf, plus the siblings at each level.

For the final iteration (L = d), the space is O(b · d) — at each of the d levels on the current path, we store up to b−1 siblings ≈ O(b) nodes.

Previous iterations use less space (smaller depth limits), so the overall space complexity is determined by the last iteration: O(b · d).

Answer: B. O(b · d)

Key Takeaway: This is the key advantage of IDDFS — it achieves BFS-level completeness and optimality (for unit costs) while using DFS-level linear space. Note: O(b·d) not O(b·m), because IDDFS never descends deeper than the current limit, and the solution is at depth d.

Question 8 — UCS Optimality Condition

📝 Problem Statement (MCQ — 2 marks)

Uniform Cost Search is guaranteed to find the optimal solution under which condition?

  1. All edge costs are equal to 1
  2. All edge costs are non-negative
  3. Every edge cost is strictly greater than some positive constant ε
  4. The branching factor is finite
✅ Detailed Solution

UCS requires that every step cost satisfies c(s, a, s′) ≥ ε for some ε > 0. This ensures:

  1. Completeness: Path costs grow without bound along any infinite path, so UCS eventually considers all paths of bounded cost.
  2. Optimality: When a node is first expanded, no cheaper path to it can be found later (monotonicity of g values on the frontier).

Why not just “non-negative”? If zero-cost edges exist, UCS could loop infinitely through zero-cost cycles without making progress, breaking both completeness and optimality.

Answer: C. Every edge cost is strictly greater than some positive constant ε

Key Takeaway: The condition is c ≥ ε > 0, not merely c ≥ 0. This is a common GATE trap. Option A (unit costs) is sufficient but not necessary — UCS handles variable costs.

Question 9 — Bidirectional Search Advantage

📝 Problem Statement (MCQ — 1 mark)

The primary advantage of bidirectional search over BFS is a reduction in:

  1. Space complexity from O(bd) to O(bd/2)
  2. Time complexity from O(bd) to O(bd/2)
  3. Time complexity from O(bd) to O(d2)
  4. Both time and space complexity from O(bd) to O(bd/2)
✅ Detailed Solution

Bidirectional search runs two simultaneous BFS searches: one from the start and one from the goal, meeting in the middle at depth d/2.

  • Time: Each BFS explores O(bd/2) nodes, so total time is O(2 · bd/2) = O(bd/2).
  • Space: Each frontier stores O(bd/2) nodes, so total space is O(bd/2).

Both time and space improve from O(bd) to O(bd/2), which is a massive reduction.

Answer: D. Both time and space from O(bd) to O(bd/2)

Key Takeaway: For b=10, d=6: normal BFS checks ~106 = 1,000,000 nodes; bidirectional checks ~2×103 = 2,000 nodes. The catch: bidirectional search requires an explicit goal state and reversible operators.

Question 10 — Strategy Selection (Conceptual)

📝 Problem Statement (MCQ — 2 marks)

You are solving a search problem with the following characteristics:

  • Branching factor b = 10
  • Solution depth d is unknown
  • All step costs are equal (unit cost)
  • Memory is severely limited (only ~100 KB available)
  • You need an optimal solution

Which uninformed search strategy is most appropriate?

  1. BFS
  2. DFS
  3. Iterative Deepening DFS
  4. Uniform Cost Search
✅ Detailed Solution

Let’s evaluate each option against the constraints:

  • BFS: Complete & optimal (unit costs), but space = O(bd) = O(10d). Even at d=5, that’s 100,000 nodes — far exceeds 100 KB. ❌ Memory fails.
  • DFS: Space = O(b·m) — manageable, but DFS is not optimal and may not even be complete. ❌ No optimality.
  • IDDFS: Complete, optimal (unit costs), space = O(b·d) = O(10d). Even at d=20, that’s only 200 nodes — fits in 100 KB easily. Time overhead is just b/(b−1) = 10/9 ≈ 11%. ✅ All criteria met.
  • UCS: Optimal, but space = O(bd) same as BFS. ❌ Memory fails. Also, UCS is overkill for unit costs.

Answer: C. Iterative Deepening DFS

Key Takeaway: IDDFS is the default choice when: (1) solution depth is unknown, (2) step costs are uniform, (3) memory is limited, and (4) optimality is required. It combines the best of BFS (completeness + optimality) with the best of DFS (linear space).

Exam Strategy Tips

  • Trace methodically: For expansion-order questions, always maintain an explicit frontier (queue/stack/priority queue) on paper.
  • Check goal test timing: Early goal test (on generation) vs. late goal test (on expansion) changes the node count.
  • Memorise the formulas: BFS time = O(bd), BFS space = O(bd), DFS space = O(b·m), IDDFS space = O(b·d), UCS complete iff c ≥ ε > 0.
  • Watch for traps: DFS is NOT complete in tree search. BFS is NOT optimal with non-uniform costs. UCS needs ε > 0, not just c ≥ 0.
  • Use elimination: For 1-mark MCQs, quickly eliminate 2 wrong options, then carefully compare the remaining two.
  • NAT precision: For numerical answers, double-check arithmetic. Common errors include off-by-one mistakes in node counts.