ITM 303

Artificial Intelligence

TU BITM · Semester 5 · BITM curriculum and programme regulation

Requirement
required
Credits
3
Practice sets
5 sets

Practice sets and model questions

5 complete syllabus-aligned practice examinations with model-style questions and step-by-step solutions. Independently prepared by Paper Khoj, not issued by TU.

practice sets loaded.

Practice Set 1

Report problem

PAPER KHOJ

Practice Examination — Set 1

For BITM · Semester 5

Based on the prescribed TU Faculty of Management syllabus and examination structure

Independently prepared by Paper Khoj. This is not an official Tribhuvan University or Dean's Office question paper.

Course: ITM 303 · Artificial Intelligence

Level: Bachelor of Information Technology Management (BITM) · Semester 5

Full Marks: 60

Time: 3 hrs.

Candidates are required to give their answers in their own words as far as practicable. The figures in the margin indicate full marks.

Group 'A'

Brief Answer Questions. Attempt all questions.

[5 × 2 = 10]
  1. [2]

    Define Artificial Intelligence and distinguish between Strong AI and Weak AI.

    View model answerHide model answer

    Artificial Intelligence & Strong vs. Weak AI:

    1. Definition of AI: The subfield of computer science dedicated to engineering computational systems and software agents capable of performing tasks that typically require human cognitive intelligence—such as perception, heuristic reasoning, problem-solving, learning, and contextual decision-making.
    2. Strong AI (General AI / AGI): Theoretical systems possessing generalized human-level or superhuman cognitive capabilities across any intellectual domain, with genuine self-awareness, abstraction, and intentionality.
    3. Weak AI (Narrow AI): Practical systems engineered and optimized to execute specific, bounded tasks (e.g. AlphaGo, facial recognition, Siri, spam filtering) without autonomous consciousness or cross-domain cognitive transfer.
  2. [2]

    What is an Intelligent Agent? Formulate the PEAS description for an Automated Taxi Driver.

    View model answerHide model answer

    Intelligent Agent & PEAS Framework:

    An Intelligent Agent is an autonomous entity that perceives its environment through sensors, processes information through internal reasoning logic, and directs its activity through actuators to maximize its expected performance measure.

    PEAS Description for an Automated Taxi Driver:

    • P (Performance Measure): Passenger safety, speed/arrival time, legal compliance (traffic laws), passenger comfort, and fuel efficiency/profit maximization.
    • E (Environment): Urban and highway roadways, pedestrian footpaths, vehicular traffic, weather conditions (rain, fog), road construction, and diverse passengers.
    • A (Actuators): Steering wheel, accelerator, brake pedal, horn, turn signals, and digital passenger interface/display.
    • S (Sensors): Video cameras, LiDAR, radar, ultrasonic sonar sensors, GPS receiver, speedometer, accelerometer, and engine diagnostic telemetry.
  3. [2]

    State the difference between Informed (Heuristic) and Uninformed (Blind) search strategies.

    View model answerHide model answer

    Informed vs. Uninformed Search:

    Feature Uninformed (Blind) Search Informed (Heuristic) Search
    Domain Knowledge Possesses no problem-specific knowledge beyond the state-space definitions and transition operators. Leverages domain-specific heuristic functions h(n)h(n) estimating distance/cost to the goal.
    Search Guidance Systematically traverses nodes purely based on tree topology or path cost. Actively guides exploration towards promising branches evaluated by evaluation function f(n)f(n).
    Efficiency High time and space complexity; prone to combinatorial state explosion. Dramatically shrinks search space; faster convergence to goal.
    Examples Breadth-First Search (BFS), Depth-First Search (DFS), Uniform Cost Search (UCS). Greedy Best-First Search, A∗A^* Search, Hill Climbing.
  4. [2]

    What is the Admissibility condition of a heuristic function in A* search?

    View model answerHide model answer

    Admissibility Condition in A∗A^* Search:

    A heuristic function h(n)h(n) is admissible if it never overestimates the actual cost to reach the nearest goal state from node nn.

    Mathematically:

    ∀n,0≤h(n)≤h∗(n)\forall n, \quad 0 \le h(n) \le h^*(n)

    where:

    • h(n)h(n) is the estimated cost from node nn to the goal.
    • h∗(n)h^*(n) is the true optimal cost from node nn to the goal.

    Significance: Admissibility is the necessary and sufficient condition for tree-search A∗A^* to guarantee optimality (discovering the absolute least-cost solution path).

  5. [2]

    Explain the Horizon Effect in game-tree search.

    View model answerHide model answer

    The Horizon Effect:

    The Horizon Effect occurs in depth-limited heuristic game playing (e.g. chess, checkers) when an inevitable, catastrophic adverse event (such as the loss of a Queen) is pushed beyond the maximum search horizon by executing delaying, sub-optimal intermediate moves (such as spite checks).

    • Because the search engine cannot see beyond its fixed depth limit (the horizon), it erroneously believes it has avoided the catastrophe, while in reality it merely delayed it at the cost of worsening its positional advantage.
    • Mitigation: Quiescence search, which dynamically extends search depth in unstable (non-quiescent) tactical capture positions until tactical calm is restored.

Group 'B'

Short Answer / Problem Solving Questions. Attempt any SIX questions.

[6 × 5 = 30]
  1. [5]

    Explain the four fundamental agent architectures: Simple Reflex, Model-based Reflex, Goal-based, and Utility-based agents with architectural diagrams and characteristics.

    View model answerHide model answer

    Four Fundamental Intelligent Agent Architectures:

    1. Simple Reflex:  [Sensors] -> [Condition-Action Rules] -> [Actuators]
    2. Model-Based:    [Sensors] -> [State + How World Evolves] -> [Condition-Action Rules] -> [Actuators]
    3. Goal-Based:     [Sensors] -> [State] + [Goals / Future Planning] -> [Actuators]
    4. Utility-Based:  [Sensors] -> [State] + [Utility Function / Trade-offs] -> [Actuators]
    

    1. Simple Reflex Agent:

    • Operates strictly on condition-action rules: IF condition THEN action\text{IF } condition \text{ THEN } action.
    • Ignores percept history; only reacts to current percept.
    • Effective only in fully observable environments; suffers infinite loops in partially observable states.

    2. Model-Based Reflex Agent:

    • Maintains internal state tracking unobserved aspects of the current environment.
    • Encapsulates two types of world knowledge:
      1. How the world evolves independently of the agent.
      2. How the agent’s own actions affect the environment.
    • Can operate successfully in partially observable environments.

    3. Goal-Based Agent:

    • Combines state knowledge with explicit goals describing desirable terminal situations.
    • Incorporates search and planning algorithms to determine multi-step sequences of actions to reach goals.
    • Highly flexible: easily reconfigured by changing target goals without reprogramming behavioral rules.

    4. Utility-Based Agent:

    • Maps states onto real numbers via a Utility Function representing the degree of desirability/happiness.
    • Resolves conflicting goals by evaluating trade-offs (e.g. speed vs. safety vs. fuel economy).
    • Enables rational decision-making under uncertainty where goals can only be achieved probabilistically.
  2. [5]

    Compare Uninformed Search Algorithms: Breadth-First Search (BFS), Depth-First Search (DFS), Depth-Limited Search (DLS), and Iterative Deepening DFS (IDDFS) across Time Complexity, Space Complexity, Completeness, and Optimality.

    View model answerHide model answer

    Comprehensive Comparison of Uninformed Search Strategies:

    Let:

    • bb = branching factor
    • dd = depth of the shallowest goal node
    • mm = maximum depth of the state space
    • ll = depth cutoff limit for DLS
    Search Strategy Time Complexity Space Complexity Completeness Optimality
    Breadth-First Search (BFS) O(bd)O(b^d) O(bd)O(b^d) (keeps all frontier nodes in memory) Yes (if bb is finite) Yes (if path cost is a non-decreasing function of depth)
    Depth-First Search (DFS) O(bm)O(b^m) O(bm)O(bm) (linear memory) No (fails in infinite paths or cyclic state spaces) No (can return deep non-optimal goal)
    Depth-Limited Search (DLS) O(bl)O(b^l) O(bl)O(bl) No (if l<dl < d) No
    Iterative Deepening DFS (IDDFS) O(bd)O(b^d) O(bd)O(bd) (linear memory) Yes (if bb is finite) Yes (if step costs are equal)

    Key Architectural Insights:

    1. BFS Memory Bottleneck: BFS is strictly memory-bound in real-world AI applications because it retains O(bd)O(b^d) nodes in RAM, causing out-of-memory crashes before CPU exhaustion.
    2. IDDFS Superiority: IDDFS combines the modest linear memory footprint of DFS (O(bd)O(bd)) with the completeness and optimality guarantees of BFS. Although top levels are regenerated, the computational overhead is negligible (typically less than 11% overhead for b=10b=10) because the overwhelming majority of nodes reside at the lowest search depth.
  3. [5]

    Explain Greedy Best-First Search and A* Search. Show why A* search is optimal when its heuristic function is admissible and consistent.

    View model answerHide model answer

    Greedy Best-First Search vs. A* Search:

    1. Greedy Best-First Search:

    • Evaluates nodes using solely the heuristic estimation: f(n)=h(n)f(n) = h(n).
    • Minimizes estimated distance to goal, ignoring accumulated past path cost g(n)g(n).
    • Prone to dead ends, cycles, and finding sub-optimal paths.

    2. A* Search:

    • Evaluates nodes using combined evaluation function:
      f(n)=g(n)+h(n)f(n) = g(n) + h(n)
      where g(n)g(n) is actual cost incurred from root to nn, and h(n)h(n) is estimated cost from nn to goal.

    Proof of A* Optimality (Admissible Heuristic):

    Let C∗C^* be the optimal goal cost. Suppose for contradiction that A∗A^* terminates by selecting a sub-optimal goal G2G_2 with cost g(G2)>C∗g(G_2) > C^*.

    1. Since G2G_2 is a goal, h(G2)=0h(G_2) = 0, so f(G2)=g(G2)+0=g(G2)>C∗f(G_2) = g(G_2) + 0 = g(G_2) > C^*.
    2. Prior to choosing G2G_2, there must exist at least one unexpanded node nn on the open frontier that lies on the true optimal path to the optimal goal GG.
    3. By admissibility, h(n)≤h∗(n)h(n) \le h^*(n), meaning:
      f(n)=g(n)+h(n)≤g(n)+h∗(n)=C∗f(n) = g(n) + h(n) \le g(n) + h^*(n) = C^*
    4. Since f(n)≤C∗<f(G2)f(n) \le C^* < f(G_2), we have:
      f(n)<f(G2)f(n) < f(G_2)
    5. A priority queue ordered by minimum ff will always expand nn before G2G_2.
    6. This holds for all nodes on the optimal trajectory until GG itself is expanded with f(G)=C∗f(G) = C^*.
    7. Thus, G2G_2 can never be selected ahead of the optimal goal. ■\blacksquare
  4. [5]

    What is a Constraint Satisfaction Problem (CSP)? Explain the AC-3 (Arc Consistency) algorithm with an example.

    View model answerHide model answer

    Constraint Satisfaction Problem (CSP) & AC-3:

    A CSP is formalized by a triplet (X,D,C)(X, D, C):

    • X={X1,X2,…,Xn}X = \{X_1, X_2, \dots, X_n\}: A set of variables.
    • D={D1,D2,…,Dn}D = \{D_1, D_2, \dots, D_n\}: A set of domains containing allowable values for each variable.
    • C={C1,C2,…,Cm}C = \{C_1, C_2, \dots, C_m\}: A set of constraints restricting allowable combinations of assignments.

    Arc Consistency Algorithm (AC-3):

    A directed arc (Xi,Xj)(X_i, X_j) is arc consistent if for every value x∈Dix \in D_i, there exists at least one value y∈Djy \in D_j that satisfies the constraint between XiX_i and XjX_j.

    AC-3 Algorithm Steps:

    1. Initialize queue QQ with all directed binary arcs in the CSP: {(Xi,Xj),(Xj,Xi),… }\{(X_i, X_j), (X_j, X_i), \dots\}.
    2. While QQ is not empty:
      • Pop arc (Xi,Xj)(X_i, X_j).
      • If Revise(CSP,Xi,Xj)\text{Revise}(CSP, X_i, X_j) deletes any value from DiD_i:
        • If Di=∅D_i = \emptyset, return Failure (no consistent solution possible).
        • For each neighbor Xk∈Neighbors(Xi)∖{Xj}X_k \in \text{Neighbors}(X_i) \setminus \{X_j\}, insert arc (Xk,Xi)(X_k, X_i) into QQ.
    3. Return Success (domain reduced to arc-consistent values).

    Example (Map Coloring):

    • Let Variables X1,X2X_1, X_2 share constraint X1≠X2X_1 \ne X_2.
    • If D1={Red}D_1 = \{\text{Red}\} and D2={Red,Green}D_2 = \{\text{Red}, \text{Green}\}.
    • Arc (X2,X1)(X_2, X_1) is revised: y=Redy = \text{Red} in D2D_2 conflicts with X1=RedX_1 = \text{Red}.
    • Value Red\text{Red} is pruned from D2D_2, reducing D2={Green}D_2 = \{\text{Green}\}. Arc consistency is achieved.
  5. [5]

    Explain the Minimax Algorithm in game-tree evaluation and describe how Alpha-Beta Pruning optimizes it without altering the final decision.

    View model answerHide model answer

    Minimax Algorithm & Alpha-Beta Pruning:

    1. Minimax Algorithm:

    Used in deterministic, perfect-information two-player zero-sum games (MAX vs. MIN):

    Minimax(s)={Utility(s)if Terminal(s)max⁡aMinimax(Result(s,a))if Player(s)=MAXmin⁡aMinimax(Result(s,a))if Player(s)=MIN\text{Minimax}(s) = \begin{cases} \text{Utility}(s) & \text{if Terminal}(s) \\ \max_{a} \text{Minimax}(\text{Result}(s, a)) & \text{if Player}(s) = \text{MAX} \\ \min_{a} \text{Minimax}(\text{Result}(s, a)) & \text{if Player}(s) = \text{MIN} \end{cases}

    • Complexity: Time O(bm)O(b^m), Space O(bm)O(bm). Exhaustive evaluation is computationally intractable for deep games (e.g. Chess b≈35,m≈80b \approx 35, m \approx 80).

    2. Alpha-Beta Pruning Optimization:

    Prunes branches that cannot influence the final minimax decision at the root:

    • α\alpha = Highest value found so far by MAX along the search path (lower bound on MAX’s payoff). Initialized to −∞-\infty.
    • β\beta = Lowest value found so far by MIN along the search path (upper bound on MIN’s payoff). Initialized to +∞+\infty.

    Pruning Conditions:

    1. At MIN node: If β≤α\beta \le \alpha, prune remaining children (alphaalpha-cutoff). MAX already has a better move elsewhere.
    2. At MAX node: If α≥β\alpha \ge \beta, prune remaining children (β\beta-cutoff). MIN already has a better defensive move elsewhere.

    Efficiency Gain:

    With perfect move ordering, alpha-beta reduces time complexity from O(bm)O(b^m) to O(bm/2)=O((b)m)O(b^{m/2}) = O((\sqrt{b})^m). This effectively doubles the search depth reachable within the same CPU time limit.

  6. [5]

    Describe Hill Climbing Search. Detail its three primary failure modes (Local Maxima, Ridges, Plateaus) and explain how Simulated Annealing resolves them.

    View model answerHide model answer

    Hill Climbing Search & Simulated Annealing:

    Hill Climbing is an iterative local search algorithm that continually moves in the direction of increasing elevation (value) to find the peak of a state-space surface.


    Three Primary Failure Modes:

    1. Local Maximum: A peak that is higher than all its neighboring states, but lower than the global maximum. The algorithm terminates prematurely thinking it found the optimum.
    2. Ridge: A sequence of local maxima joined by steep slopes where standard orthogonal coordinate moves step down on either side, halting progress.
    3. Plateau (Shoulder / Flat Maximum): A flat area of the state-space landscape where all neighboring states possess identical heuristic values, leaving the search with no directional gradient.

    How Simulated Annealing Resolves These Limitations:

    Inspired by metallurgy (gradual cooling of molten metal to form defect-free crystalline structures):

    • Instead of purely greedy moves, it allows downhill (sub-optimal) moves with a probability governed by the Boltzmann distribution:
      P(ΔE)=eΔETP(\Delta E) = e^{\frac{\Delta E}{T}}
      where ΔE=Enext−Ecurrent<0\Delta E = E_{\text{next}} - E_{\text{current}} < 0, and TT is temperature.
    • When TT is high (early phase), the agent frequently accepts worse moves, escaping local maxima and exploring wide basins.
    • As temperature TT gradually cools according to an annealing schedule (T→0T \to 0), the probability of accepting downhill moves drops to zero, smoothly transitioning into standard greedy local optimization.

Group 'C'

Comprehensive / Analytical Questions. Attempt all questions.

[2 × 10 = 20]
  1. [10]

    Consider the state-space graph where S is the start node and G is the goal node. The step costs g(n) between nodes and heuristic values h(n) to the goal G are given as follows:

    • S->A: 3, S->B: 2, S->C: 4
    • A->D: 5, A->E: 4
    • B->E: 3, B->F: 6
    • C->F: 2
    • D->G: 4, E->G: 3, F->G: 5 Heuristics: h(S)=7, h(A)=6, h(B)=5, h(C)=6, h(D)=3, h(E)=2, h(F)=4, h(G)=0. Perform a step-by-step trace of A* search. Show the Open and Closed lists at each step, path costs g, heuristic values h, evaluation function f = g + h, and identify the optimal solution path and total cost.
    View model answerHide model answer

    Step-by-Step A* Search Graph Traversal:

    Evaluation function: f(n)=g(n)+h(n)f(n) = g(n) + h(n)


    Iteration Trace:

    Step 1: Initialize

    • Open List: {[S:g=0,h=7,f=7]}\{[S: g=0, h=7, f=7]\}
    • Closed List: {}\{\}

    Step 2: Expand SS (f=7f=7)

    • Successors of SS:
      • A:g=0+3=3,h=6  ⟹  f(A)=3+6=9A: g = 0 + 3 = 3,\quad h = 6 \implies f(A) = 3 + 6 = 9, Path: S→AS \to A
      • B:g=0+2=2,h=5  ⟹  f(B)=2+5=7B: g = 0 + 2 = 2,\quad h = 5 \implies f(B) = 2 + 5 = 7, Path: S→BS \to B
      • C:g=0+4=4,h=6  ⟹  f(C)=4+6=10C: g = 0 + 4 = 4,\quad h = 6 \implies f(C) = 4 + 6 = 10, Path: S→CS \to C
    • Open List: {[B:f=7],[A:f=9],[C:f=10]}\{[B: f=7], [A: f=9], [C: f=10]\}
    • Closed List: {S}\{S\}

    Step 3: Expand BB (Minimum f=7f=7)

    • Successors of BB:
      • E:g=2+3=5,h=2  ⟹  f(E)=5+2=7E: g = 2 + 3 = 5,\quad h = 2 \implies f(E) = 5 + 2 = 7, Path: S→B→ES \to B \to E
      • F:g=2+6=8,h=4  ⟹  f(F)=8+4=12F: g = 2 + 6 = 8,\quad h = 4 \implies f(F) = 8 + 4 = 12, Path: S→B→FS \to B \to F
    • Open List: {[E:f=7],[A:f=9],[C:f=10],[F:f=12]}\{[E: f=7], [A: f=9], [C: f=10], [F: f=12]\}
    • Closed List: {S,B}\{S, B\}

    Step 4: Expand EE (Minimum f=7f=7)

    • Successors of EE:
      • G:g=5+3=8,h=0  ⟹  f(G)=8+0=8G: g = 5 + 3 = 8,\quad h = 0 \implies f(G) = 8 + 0 = 8, Path: S→B→E→GS \to B \to E \to G
    • Open List: {[G:f=8],[A:f=9],[C:f=10],[F:f=12]}\{[G: f=8], [A: f=9], [C: f=10], [F: f=12]\}
    • Closed List: {S,B,E}\{S, B, E\}

    Step 5: Expand GG (Minimum f=8f=8)

    • GG is the goal state! When a goal node is removed from Open list for expansion, A∗A^* terminates with guaranteed optimality.

    Summary Table:

    Step Node Picked g(n)g(n) h(n)h(n) f(n)f(n) Generated Children Open List (Priority Ordered)
    1 - - - - SS {S(7)}\{S(7)\}
    2 SS 0 7 7 A(9),B(7),C(10)A(9), B(7), C(10) {B(7),A(9),C(10)}\{B(7), A(9), C(10)\}
    3 BB 2 5 7 E(7),F(12)E(7), F(12) {E(7),A(9),C(10),F(12)}\{E(7), A(9), C(10), F(12)\}
    4 EE 5 2 7 G(8)G(8) {G(8),A(9),C(10),F(12)}\{G(8), A(9), C(10), F(12)\}
    5 GG (Goal) 8 0 8 Terminated Goal reached optimally

    Final Solution:

    • Optimal Path: S→B→E→GS \to B \to E \to G
    • Total Path Cost: g(G)=8g(G) = 8
  2. [10]

    Apply the Minimax Algorithm with Alpha-Beta Pruning on a 3-ply game tree where root node A (MAX) has children B and C (MIN).

    • Node B has terminal children: D=4, E=6, F=2
    • Node C has terminal children: G=8, H=1, I=9 Trace the exact order of node evaluations, update alpha and beta values at each step, determine all pruned branches (cutoffs), calculate the minimax values for nodes B, C, and A, and state the optimal opening move.
    View model answerHide model answer

    Minimax with Alpha-Beta Pruning Complete Trace:

                         A (MAX)  [alpha=-inf, beta=+inf]
                        /       \
                       /         \
                B (MIN)           C (MIN)
               /   |   \         /   |   \
              D    E    F       G    H    I
             [4]  [6]  [2]     [8]  [1]  [9]
    

    Step-by-Step Traversal Trace:

    1. At Root Node A (MAX):

      • Initialize α=−∞,β=+∞\alpha = -\infty, \beta = +\infty.
      • Visit first child B (MIN) passing α=−∞,β=+∞\alpha = -\infty, \beta = +\infty.
    2. At Node B (MIN):

      • Initialize for B: α=−∞,β=+∞\alpha = -\infty, \beta = +\infty.
      • Evaluate child D: Value = 44.
        • β=min⁡(+∞,4)=4\beta = \min(+\infty, 4) = 4.
        • Check: α(−∞)<β(4)  ⟹  \alpha (- \infty) < \beta (4) \implies No cutoff.
      • Evaluate child E: Value = 66.
        • β=min⁡(4,6)=4\beta = \min(4, 6) = 4.
        • Check: α(−∞)<β(4)  ⟹  \alpha (- \infty) < \beta (4) \implies No cutoff.
      • Evaluate child F: Value = 22.
        • β=min⁡(4,2)=2\beta = \min(4, 2) = 2.
        • Check: α(−∞)<β(2)  ⟹  \alpha (- \infty) < \beta (2) \implies No cutoff.
      • All children of B evaluated.
      • Return minimax value of B=2B = 2.
    3. Back at Root Node A (MAX):

      • Updates from left child B:
        • α=max⁡(−∞,2)=2\alpha = \max(-\infty, 2) = 2.
        • β\beta remains +∞+\infty.
      • Visit second child C (MIN) passing α=2,β=+∞\alpha = 2, \beta = +\infty.
    4. At Node C (MIN):

      • Inherits bounds: α=2,β=+∞\alpha = 2, \beta = +\infty.
      • Evaluate child G: Value = 88.
        • β=min⁡(+∞,8)=8\beta = \min(+\infty, 8) = 8.
        • Check: α(2)<β(8)  ⟹  \alpha (2) < \beta (8) \implies No cutoff.
      • Evaluate child H: Value = 11.
        • β=min⁡(8,1)=1\beta = \min(8, 1) = 1.
        • Check Cutoff Condition:
          β(1)≤α(2)  ⟹  ALPHA CUTOFF OCCURS!\beta (1) \le \alpha (2) \implies \text{\textbf{ALPHA CUTOFF OCCURS!}}
        • Since β≤α\beta \le \alpha, MIN at node C can already guarantee a score of at most 11. MAX at root A already has guaranteed score of 22 from branch B. Therefore, MAX will never choose branch C regardless of what follows.
      • Pruning: Child I (value 9) is PRUNED and never evaluated!
      • Node C terminates with value ≤1\le 1 (effective value 11).
    5. Back at Root Node A (MAX):

      • α=max⁡(2,1)=2\alpha = \max(2, 1) = 2.
      • Final minimax value at root A=2A = 2.

    Final Evaluation Summary:

    • Minimax Value of Node B: 22
    • Minimax Value of Node C: 11 (with pruning)
    • Minimax Value of Node A (Root): 22
    • Pruned Branch: Node I is pruned under node C (α\alpha-cutoff).
    • Optimal Move for MAX: Move to Node B.