Artificial Intelligence, Past Papers, UOS Main Campus

Artificial Intelligence Past Paper 2016 – BSCS 6th Term UOS (CS-3811)

ProgramBSCS
Term6th
Year2016
Course codeCS-3811
AnswersSolved ✓

University of Sargodha BS Computer Science 6th term Artificial Intelligence (CS-3811) paper, 2016 exam (80 marks, 2:30 hours). The paper is retyped below, followed by solved answers for all 16 short questions and all five subjective questions: Bayesian networks, DFS vs depth-limited search, informed vs uninformed search, first-order logic and neural networks.

Solved answers

Q1 – Short answers (16 × 2)

A. Artificial Intelligence. The branch of computer science that builds systems which perform tasks needing human intelligence – reasoning, learning, perception, language understanding and problem solving. Russell & Norvig define it as the study of agents that act rationally.

B. Weak AI. Narrow AI: systems that simulate intelligence for a specific task (chess programs, Siri, spam filters) without real understanding or consciousness. Strong AI would have general, human-like intelligence.

C. Turing Test. Proposed by Alan Turing (1950): a human judge chats by text with a machine and a human; if the judge cannot reliably tell which is the machine, the machine is said to show intelligent behaviour.

D. Agent. Anything that perceives its environment through sensors and acts on it through actuators, e.g. a robot (cameras, motors) or a software agent (keystrokes, screen output). A rational agent chooses the action expected to maximise its performance measure.

E. Is AI only based on searching? No. Search is a core technique, but AI also uses knowledge representation and logic, probabilistic reasoning, machine learning, planning, natural language processing, perception and robotics.

F. Knowledge. Facts, rules and relationships about a domain that an AI system stores (knowledge base) and uses to reason, e.g. “All humans are mortal”. Represented with logic, rules, semantic networks or frames.

G. Heuristic. A rule of thumb or estimate that guides search toward the goal, e.g. h(n) = straight-line distance to the destination; it reduces search time but may not always give the best answer.

H. Completeness. A search algorithm is complete if it is guaranteed to find a solution whenever one exists (e.g. BFS is complete; DFS is not complete in infinite spaces).

I. Local search. Search that keeps only the current state and moves to neighbouring states to improve an objective, without remembering paths, e.g. hill climbing, simulated annealing, genetic algorithms. Uses little memory; may get stuck at local maxima.

J. Example of first order logic. ∀x (Student(x) → Studies(x)) – “every student studies”; ∃x (Bird(x) ∧ ¬Flies(x)) – “some bird does not fly”.

K. Posterior probability. The probability of a hypothesis after seeing the evidence, P(H | E) = P(E | H)·P(H) / P(E) (Bayes’ rule), e.g. the probability of a disease given a positive test.

L. Learning. The ability of an agent to improve its performance on a task from experience/data, e.g. supervised learning from labelled examples, unsupervised learning, reinforcement learning from rewards.

M. Neuron. The basic unit of a neural network: it computes a weighted sum of inputs plus a bias and passes it through an activation function, y = f(Σ wixi + b), modelled on the biological nerve cell.

N. Semantics. The meaning of sentences in a representation language – how a sentence relates to the world (when it is true), as opposed to syntax, which is only its form.

O. Modus Tollens. The inference rule: from P → Q and ¬Q, conclude ¬P. Example: “If it rains the ground is wet; the ground is not wet; so it did not rain.”

P. Entropy. A measure of uncertainty/impurity of a set: H(S) = −Σ pi log2 pi. It is 0 for a pure set and 1 for a 50/50 binary split; used for information gain in decision trees.

Q2 – Bayesian network

A Bayesian (belief) network is a directed acyclic graph that represents the joint probability distribution of a set of random variables. Each node is a variable; an arrow X → Y means X directly influences Y; each node has a conditional probability table (CPT) P(X | Parents(X)).

The joint probability is the product of the local CPTs: P(x1, …, xn) = Π P(xi | parents(Xi)). This needs far fewer numbers than the full joint table because each variable is conditionally independent of its non-descendants given its parents.

Example (burglary alarm): Burglary → Alarm ← Earthquake, Alarm → JohnCalls, Alarm → MaryCalls. P(B) = 0.001, P(E) = 0.002, P(A | B, ¬E) = 0.94, P(A | ¬B, ¬E) = 0.001, P(J | A) = 0.90, P(M | A) = 0.70. Then P(J, M, A, ¬B, ¬E) = P(J|A)·P(M|A)·P(A|¬B,¬E)·P(¬B)·P(¬E) = 0.90 × 0.70 × 0.001 × 0.999 × 0.998 ≈ 0.00063.

  • Inference: exact (enumeration, variable elimination) or approximate (sampling) to compute P(query | evidence), e.g. P(Burglary | JohnCalls, MaryCalls).
  • Uses: medical diagnosis, fault detection, spam filtering, decision support.
  • Advantages: compact, handles uncertainty, combines expert knowledge with data, can reason both from causes to effects and from effects to causes.

Q3 – Depth First vs Depth Limited Search

Depth First Search (DFS)Depth Limited Search (DLS)
IdeaAlways expands the deepest unexpanded node (LIFO stack)DFS with a fixed depth limit l; nodes at depth l are treated as having no successors
Infinite pathsMay go down an infinite branch foreverCannot go deeper than l, so it always stops
Complete?No (in infinite or cyclic spaces)Complete only if the shallowest goal depth d ≤ l
Optimal?NoNo (also fails if l < d)
TimeO(bm), m = maximum depthO(bl)
SpaceO(bm)O(bl)
Failure typesFails/loopsTwo results: failure (no solution) or cutoff (no solution within the limit)

DLS solves the infinite-path problem of DFS when the depth of the solution is known (e.g. 20 cities → limit 19). Repeating DLS with limits 0, 1, 2, … gives Iterative Deepening Search, which is complete and optimal for unit step costs.

Q4 – Informed vs uninformed search

Uninformed (blind) searchInformed (heuristic) search
KnowledgeUses only the problem definition (states, actions, goal test)Uses extra problem-specific knowledge: heuristic h(n) estimating cost to the goal
ExamplesBFS, DFS, uniform-cost, depth-limited, iterative deepening, bidirectionalGreedy best-first, A*, IDA*, hill climbing
EfficiencyExplores many nodes; slow for large spacesExpands fewer nodes; much faster
EvaluationOrder fixed by the strategy (depth or path cost g(n))f(n) = h(n) (greedy) or f(n) = g(n) + h(n) (A*)
OptimalityBFS/UCS optimal (UCS for any step cost)A* optimal if h is admissible (never overestimates)

Example: in route finding from Arad to Bucharest, BFS expands cities level by level, while A* with straight-line distance heads directly toward Bucharest.

Q5 – First Order Logic

First-order logic (predicate logic) extends propositional logic: it can talk about objects, their properties and relations, and use quantifiers.

  • Syntax: constants (Ali, 2), variables (x, y), predicates (Student(x), Loves(x, y)), functions (Father(x)), connectives ¬ ∧ ∨ → ↔, quantifiers ∀ (for all) and ∃ (there exists), equality =.
  • Terms refer to objects; atomic sentences are predicates applied to terms; complex sentences are built with connectives and quantifiers.
  • Semantics: a model gives a domain of objects and an interpretation of every symbol; ∀x P(x) is true if P holds for every object, ∃x P(x) if it holds for at least one.
  • Rules: ¬∀x P ≡ ∃x ¬P; universal instantiation, existential instantiation, generalized Modus Ponens, unification, resolution, forward and backward chaining.

Examples: “All men are mortal”: ∀x (Man(x) → Mortal(x)); “Socrates is a man”: Man(Socrates); therefore Mortal(Socrates). “Everyone loves someone”: ∀x ∃y Loves(x, y). “Brothers are siblings”: ∀x ∀y (Brother(x, y) → Sibling(x, y)).

FOL is more expressive than propositional logic (one sentence can cover all objects) and is used in knowledge bases, expert systems and Prolog.

Q6 – Neural Networks

An artificial neural network (ANN) is a model inspired by the brain, made of many connected neurons arranged in layers: an input layer, one or more hidden layers and an output layer. Each connection has a weight.

  • Neuron: net = Σ wixi + b, output y = f(net), where f is an activation function – step, sigmoid 1/(1 + e−x), tanh, ReLU max(0, x).
  • Perceptron: a single neuron with a step function; it learns linearly separable functions (AND, OR) with the rule w ← w + η(t − y)x, but cannot learn XOR.
  • Multilayer feed-forward network: hidden layers allow non-linear functions such as XOR.
  • Training (back-propagation): forward pass computes the output; the error (e.g. squared error or cross-entropy) is measured; the error gradient is propagated backward and weights are updated by gradient descent w ← w − η ∂E/∂w; repeated for many epochs.
  • Types: feed-forward, recurrent (RNN, LSTM) for sequences, convolutional (CNN) for images.
  • Applications: handwriting and speech recognition, image classification, medical diagnosis, prediction, language translation.
  • Pros/cons: learns from examples, handles noise, very powerful; but needs much data and computation, and is hard to interpret (black box).
Save this paper for offline studyDownload the question paper, or save the paper together with all solved answers as a PDF.
↓ Download Paper (JPG)

About Saif R

An educator and technology enthusiast passionate about empowering students through quality education and digital learning. Dedicated to making academic resources and opportunities accessible to everyone.