TEST 2 CS724

Instructor Dr P Juell    NAID______________________ NAME__________________________
100 points, closed book                                  March 22, 2001
  1. (20) Write a Prolog program to test if a list is a palindrome. That is reads the same forward and backward (ie [ab,cd,eee,cb,ab] is a palindrome). You will probably want to write a functor to reverse a list.
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
  2. (20) Write a DCG program to produce the following sentences. You can assume all of the tools/functions you had in the grammar2.pl program.
            The man sang.
            The dog barked.
            The cat meowed.
    
    You only need to generate the above sentences, but it is to be done in a general fashion, so that other names can be added and only the correct action will be generated for that name.
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
  3. (10) The lisp version of the blocks program is 249 lines long while the rules.pl version is 24 lines long. Since the two programs do approximately the same operations explain why there is such a difference in size between the two.
    
    
    
    
  4. (10) Why are expert systems typically developed using rapid prototyping rather than just writing the program you want the first time?
    
    
    
    
    
    
  5. (20) Draw a semantic network showing the normal relationship of: bird animal fish canary tuna. Include one property for each node.
    
    
    
    
    
    
    
    
    
    
    
    
    
  6. (20) What does the following CD notation say?
    
                                                       |----> car
                                 o               R     |
         Mary  <===> PROPEL  <--------- key  <---------|
                 ^                                     |
                / \                                    |----< pocket
                |||
                |||
                |||  |----->running
             /-------|
         car<--------|
             \-------|
                 p   |-----< off