2024 11 12 CSC407StudyGuide4Midterms
2024 11 12 CSC407StudyGuide4Midterms
1
Practice Problems
1. List and briefly describe the properties of an intelligent agent
2. What is a simple reflex agent? What is goal-based agent. What are the key diffences between
these two types of intelligent agents?
3. (a) Evaluate the following:
(i) > (list ’(a) ’(b c) ’d ’(e))
(ii) > (cons ’(a) ’(b c))
(iii) > (append ’(a) ’(b c d))
(iv) > (member ’z ’(a b z c z d))
(v) > (member ’(b c) ’(a (b c) d) :test #′ equal )
(b) Consider the function
(defun mystery (x)
(let (( result 1))
(dotimes (count x result)
(setf result (* (+ 1 count) result)))))
(i) What is the purpose of this function?
(ii) What is the value of >(mystery 4)?
4. (a) Write recursive function in LISP to compute n!
(b) Write a function called displaySquares in Lisp that prints out the squares of the integers from
a given starting integer to a given final integer. For example,
(displayIntegers start end)
3 9
4 16
5 25
DONE
4 4
A B C
S 5 5 G
4 3
D E F
2 4
5. (a) Show how depth-first search would search the net shown in figure 1.
(b) Draw the complete search tree produced during branch-and-bound search with dynamic pro-
gramming of the net shown in figure 1.
6. (a) Show how breadth-first search would search the net shown in figure 1.
(b) Draw the complete search tree produced during branch-and-bound search with underesti-
mates of the net shown in figure 1.
2
A(3, 6) B(7, 6) C (11, 6)
S(0, 3) G (14, 3)
7. (a) Draw the complete search tree produced during hill-climbing search of the net shown in figure
2.
(b) Draw the complete search tree produced during best-first search of the net shown in figure 2.
(c) Draw the complete search trees produced during Branch-and-Bound with Underestimates
and A∗ search of the net shown in figure 2.
8. (a) Show that ¬( p ∧ (¬ p ∨ q)) and ¬ p ∨ ¬q are logically equivalent.
(b) Show that ( p ∧ q) =⇒ ( p ∨ q) is a tautology.
9. Use the following to write quantified first order predicate logic formulas.
• P( x ) = x is a programmer.
• S( x ) = x is smart.
• L( x, y) = x loves y.
A horse is an animal
Therefore, the head of a horse is the head of an animal.
Define the following:
3
• H ( x, y) = x is the head of y.
• A( x ) = x is an animal.
• S( x ) = x is a horse.
The premise and conclusion are
(∀ x )(S( x ) ⇒ A( x ))
(∀ x ){[(∃y)(S(y) ∧ H ( x, y))] ⇒ [(∃z)( A(z) ∧ H ( x, z))]}.
Prove the conclusion using resolution refutation. Show all ten steps in clausal conversion for the
conclusion.
12. Consider the following set of premises:
1. Some programmers hate all failures.
2. No programmer hates any success.
Use Resolution Refutation to prove that the following conclusion follows from these premises:
No failure is a success.
You may use the following predicates:
• P( x ) = x is a programmer.
• F ( x ) = x is a failure.
• S( x ) = x is a success.
• H ( x, y) = x hates y.
13. Consider the following statement: “All persons have a hobby; all professors are persons; DrNo is
a professor.” The predicate calculus sentences for this knowledge may be expressed in clause form
as
a. ¬Person(x) ∨ hasHobby(x,f(x))
b. ¬Professor(u) ∨ Person(u)
c. Professor(DrNo)
Use the set-of-support strategy for resolution refutation to prove the theorem below. (Remember
that a refutation proof is proof by contradiction using the negation of the theorem.) Show all the
steps and substitutions.
14. Show the steps required to put the following axioms into clause form:
15. The following axiom says that,if x is above y, but is not directly on y, then there must exist some
third bloc, z, in between x and y :
Put the axiom in clause form. Note that you need to introduce a Solem function.
16. The logical operator ”⇒” is read ”if and only if.” ”P ⇔ Q” is defined as being equivalent to
( P ⇒ Q) ∧ ( Q ⇒ P). Based on this definition, show that P ⇔ Q is logically equivalent to
( P ⇒ Q) ∧ ( Q ⇒ P) :
a. By using truth tables.
4
b. By a series of substitutions using the logical identities.