← Exam 2 home

5 · MCQ concepts: Poole–Mackworth ch 3–5 + data structures

15 MCQs at 0.5 points each. On Exam 1, about half were Poole–Mackworth (PM) one-line definitions and half were quick DPV facts. This page is the definitions and the "exam phrasing → answer" rules. Drill them on the MCQ drill bank.

How to answer a definition MCQ in 30 seconds.
  1. Find the one keyword in the stem ("arc costs", "heuristic", "fewest arcs", "linear space", "every model", "can't be proved").
  2. Map it with the tables below.
  3. Be suspicious of "All of the above" when one option describes a different property (Exam 1 Q9: deterministic ≠ fully observable).
  4. If two options are both true but one is tight, pick the tight one (Exam 1 Q17: \(O(n)\) over \(O(2^n)\)).

Classic traps (read these twice)

Trap statementTruth
"F → T is false."Wrong. \(p \to q\) is false only when p is T and q is F. F → T and F → F are both T.
"A definite-clause query answered no means the atom is false."Wrong. "No" means not entailed: the atom is false in the minimal model but true in other models.
"GAC left every domain non-empty, so a solution exists."Wrong. Non-empty but not all singletons means "don't know yet". Example: X, Y, Z ∈ {red, green}, all pairs ≠: GAC deletes nothing, no solution.
"Local search ran an hour without success, so there is no solution."Wrong. Local search is incomplete: it can never prove unsatisfiability.
"BFS needs memory linear in solution depth."Wrong. BFS memory is exponential, \(O(b^d)\). DFS (and iterative deepening, DF branch and bound) is linear, \(O(bd)\).
"A* always returns an optimal path."Only if h is admissible (never overestimates), the branching factor is finite and arc costs are bounded above zero.
"Iterative deepening wastes most of its time redoing shallow levels."Wrong. Overhead is a constant factor, about \(b/(b-1)\): the last level dominates.
"Dijkstra works with negative edges if there are no negative cycles."Wrong. One negative edge can improve an already-finalized vertex. Use Bellman–Ford (or the DAG pass if acyclic).
"Add a constant to every edge to remove negative lengths, then run Dijkstra."Wrong (DPV 4.8). Adding c adds \(c \cdot (\#\text{edges})\), so paths with more edges are penalized and shortest paths change. Multiplying every length by a positive constant does not change them.
"DFS from s finds distances."Wrong. BFS does (unit lengths). DFS depth is not distance.
"O(nW) knapsack is polynomial."Pseudo-polynomial: W takes only \(\log W\) bits to write.
"Greedy by value/weight is optimal for 0/1 knapsack."Only for fractional knapsack.
"A contradictory KB entails nothing."It entails everything (no models, so g is true in all of them vacuously).
"Adding facts can only add conclusions."False with negation as failure: it is nonmonotonic.
"Every valid proposition is satisfiable" / "every satisfiable one is valid."First is true; second is false (p → q is satisfiable, not valid).
"Hash table search is O(1)."Expected \(O(1)\) under assumptions (simple uniform / universal hashing). Worst case \(\Theta(n)\).

Exam 1 PM recap (ch 1–2, lower priority now)

PhraseAnswer
Inputs to an agentAbilities, goals/preferences, prior knowledge, past experiences, observations ("All of the above")
DeterministicNext state is predictable from current state + action (not "knows its state": that is full observability)
Memory of the past used for current and future actionsBelief state
Search that uses arc costsLowest-cost-first (also A*, which adds a heuristic)
Search that uses a heuristic functionA* (also greedy best-first)

PM ch 3: searching for solutions

Vocabulary

TermMeaning
FrontierThe set of paths generated but not yet expanded. The strategy = how you pick from it.
Branching factor bNumber of neighbours (forward branching factor) of a node.
Heuristic h(n)Estimate of the cost of the cheapest path from n to a goal. Non-negative, cheap to compute.
Admissible hNever overestimates: \(h(n) \le\) actual cost of the cheapest path from n to a goal. \(h \equiv 0\) is admissible (and useless).
Consistent (monotone) h\(h(n) \le \text{cost}(n, n') + h(n')\). Consistent implies admissible (with h(goal) = 0). Needed so multiple-path pruning keeps A* optimal.
Cycle pruningDiscard a path whose last node already appears earlier on that same path. Cheap.
Multiple-path pruningKeep an explored set (closed list); discard a path to a node already reached. Can cost exponential memory, like BFS.
Iterative deepeningDepth-bounded DFS with bound 1, 2, 3, …. Linear space and finds fewest-arc paths; overhead factor about \(b/(b-1)\).
Depth-first branch and boundDFS that keeps the best solution cost so far as a bound; prunes a path p when \(\text{cost}(p) + h(p) \ge\) bound (h admissible). Linear space; finds a least-cost path given an initial bound above the optimum.
Greedy best-firstPick the path whose end has smallest h(p), ignoring cost so far. Not guaranteed to find a path or the best one.

Strategy summary (PM Figure 3.18)

StrategySelects from frontierPath found (guaranteed)Space
Breadth-firstfirst added (FIFO queue)fewest arcs\(O(b^d)\) exponential
Depth-firstlast added (LIFO stack)none (can follow an infinite path)\(O(bd)\) linear
Iterative deepeningn/afewest arcs\(O(bd)\)
Greedy best-firstmin h(p)none\(O(b^d)\)
Lowest-cost-firstmin cost(p) (priority queue)least cost\(O(b^d)\)
A*min cost(p) + h(p)least cost (h admissible)\(O(b^d)\)
DF branch and boundn/aleast cost\(O(bd)\)

"Path found" assumes finite branching factor and arc costs bounded above zero.

Exam phrasing → answer

PM ch 4: reasoning with constraints

TermMeaning
Possible worldA total assignment: a value for every variable. Count = product of domain sizes (\(d^n\) if all equal).
ConstraintScope (set of variables) + relation. Intensional (formula, A < B) or extensional (table of allowed tuples).
Unary / binary / k-aryScope of size 1 / 2 / k. B ≠ 3 unary; A = D binary; X + Y = Z ternary; alldifferent(9 cells) 9-ary.
Model (solution)A possible world satisfying every constraint.
Generate-and-testCheck every total assignment. Correct, exponential.
BacktrackingDFS over partial assignments; check a constraint as soon as its whole scope is assigned; prune on failure.
Forward checkingAfter assigning, delete now-impossible values from unassigned neighbours; back up if one becomes empty.
Most constrained variable (MRV)Pick the variable with the fewest remaining values ("fail first"). Ties: most constraining variable (most constraints with unassigned variables).
Least constraining valueTry first the value ruling out the fewest neighbour values ("succeed first").
Arc <X, c> consistentEvery value of X has a support: values of c's other variables satisfying c.
GACTo-do list of arcs; prune unsupported values; when dom(X) shrinks, re-add <Z, c'> for every other constraint c' on X and other variable Z in c'. Final domains don't depend on arc order. Binary: \(O(cd^3)\).
Domain splittingSplit a domain into cases, rerun GAC on each. With GAC, complete.
Variable eliminationJoin all constraints on X, project X out. Cost = largest relation built; depends on elimination order (treewidth).
Local searchStart from a total assignment; move to neighbours to reduce h = number of violated constraints. Scales; incomplete.
Local minimum / plateauAll neighbours worse / all neighbours equal.
Random restart / random walkBig jump (new random assignment) / small random move with probability p.
Tabu listDon't undo any of the last t changes; avoids cycling on plateaus.
Simulated annealingAccept a worse move by Δ with probability \(e^{-\Delta/T}\); lower T over time. High T ≈ random walk, low T ≈ greedy.
Beam / stochastic beam / GAKeep k best / keep k chosen at random weighted by quality / crossover + mutation of parents.
Runtime distributionFraction of runs solved within k steps. Restarts every k steps with success q: fail r times in a row with probability \((1-q)^r\).
Soft constraint / branch and boundCost function on scope; minimize total. Prune partial assignment whose lower bound ≥ best found.

GAC: three outcomes

When GAC stopsConclusion
Some domain emptyNo solution.
Every domain a singletonThat assignment is the unique solution.
Some domain has ≥ 2 valuesUnknown: 0, 1 or many solutions. Split and recurse.

Quick GAC on \(A < B\), both {1,2,3,4}: A loses 4, B loses 1. On \(A \le B - 2\): A = {1, 2}, B = {3, 4}.

PM ch 5: propositions and inference

TermMeaning
InterpretationAssigns T/F to every atom. n atoms → \(2^n\) interpretations.
Model of KBInterpretation making every proposition in KB true.
Valid / satisfiable / unsatisfiableTrue in all / some / no interpretations. p ∨ ¬p / p → q / p ∧ ¬p.
KB ⊨ g (entails)g true in every model of KB. Semantic. Equivalent: KB ∪ {¬g} unsatisfiable.
KB ⊢ g (derives)A proof procedure derives g. Syntactic.
SoundKB ⊢ g ⇒ KB ⊨ g (derives only consequences).
CompleteKB ⊨ g ⇒ KB ⊢ g (derives all consequences).
Clause / DPLLDisjunction of literals. DPLL = backtracking + unit propagation (+ pure symbols). Unit propagation is arc consistency for clauses.
Definite clauseh ← a1 ∧ … ∧ am, exactly one atom in the head. m = 0: a fact. Cannot say anything is false; always has a minimal model.
Bottom-up (forward chaining)Fire clauses whose bodies are derived until fixpoint. Result = minimal model. Sound and complete for atoms; linear time. Derives everything.
Top-down (SLD resolution)Start with yes ← query; replace a selected atom by a clause body; success at "yes ←". Only touches relevant clauses; depth-first can loop (a ← b, b ← a).
Askable atomThe user is asked about it only when a proof needs it.
Integrity constraintfalse ← a1 ∧ … ∧ ak. Definite clauses + integrity constraints = Horn clauses. A Horn KB can be inconsistent.
Assumable / conflictAtom assumed true unless contradicted / set of assumables that with KB implies false. Minimal if no proper subset is a conflict.
Consistency-based diagnosisMinimal hitting set of the minimal conflicts.
Complete knowledge assumptionThe clauses for a are the only ways a can be true: Clark's completion a ↔ b1 ∨ … ∨ bn. Atom with no clauses is false.
Negation as failure ~aSucceeds when a cannot be proved. Nonmonotonic.
AbductionExplanation of g: set H of assumables with KB ∪ H ⊨ g and KB ∪ H consistent. Effects → possible causes.
Causal vs evidentialCausal: effect ← cause (lit_l1 ← live_w1 ∧ ok_l1). Evidential: cause ← effect (fire ← smoke).
Knowledge-level debuggingIncorrect answer: find a clause with true body and false head. Missing answer: a true atom with no clause whose body is all true. Uses only the intended interpretation.

Exam phrasing → answer

DPV and data structures: one-line facts

DFS (ch 3)

Shortest paths (ch 4)

AlgorithmLengthsTime
BFS (FIFO queue)unit\(O(V+E)\)
Dijkstra, binary heap≥ 0\(O((V+E)\log V)\)
Dijkstra, unsorted array≥ 0\(O(V^2)\), better for dense graphs
Dijkstra, Fibonacci heap≥ 0\(O(V\log V + E)\)
Bellman–Fordany, detects negative cycles\(O(VE)\)
DAG: linearize + one passany (acyclic)\(O(V+E)\); longest path by negating or max

Heaps / priority queues

Operation (binary min-heap, n keys)Time
find-min (root)O(1)
insert, deletemin, decreasekeyO(log n): bubble up/sift down along height \(\lfloor\log_2 n\rfloor\)
build heap from n keysΘ(n)
heap sortO(n log n)

Array layout (1-indexed): children of i at 2i and 2i + 1, parent at \(\lfloor i/2 \rfloor\). d-ary heap: deletemin \(O(d\log n/\log d)\), insert/decreasekey \(O(\log n/\log d)\).

Hash tables

Union-find (DPV §5.1.4)

ADTs (week 6, Morin)

ADTOperations / policy
Queue (FIFO)add-last + remove-first. BFS.
Stack (LIFO)push = add-last, pop = remove-last. DFS.
Priority queueremove by priority. Heap. Dijkstra, Prim, Huffman.
Dequeadd-first, remove-first, add-last, remove-last.
Listsize, get(i), set(i,y), add(i,x), remove(i). add-first = add(0,x); remove-last = remove(size()−1).
USetsize, add, remove, find; unique, unordered. Dictionary/map = USet of (key, value) pairs.
SSetTotal order; find(x) = successor search: smallest y ≥ x, or null.

Array-based: O(1) get/set. Pointer-based: faster insert/delete.

Greedy (ch 5)

Dynamic programming (ch 6)