Prolog Assignment

Due Tuesday November 22,2005

 

Name ____________________________  Possible points: 16  Earned Points ____

 

For each of these questions, you should try to answer it without running the query and you should then run it to see if you are correct.  Do screen captures and attach them to this sheet to demonstrate that you ran them and that they worked.  Use the database in the box below.

 

works_for (finance_manager, director).

works_for (administration_manager, director).

works_for (production_manager, director).

works_for (finance_officer, finance_manager).

works_for (clerk, finance_officer).

works_for (cashier, finance_officer).

works_for (receptionist, administration_manager).

works_for (typist, administration_manager).

works_for (telephonist, administration_manager).

works_for (sales_officer, production_manager).

works_for (stores_manager, production_manager).

works_for (publicity_officer, production_manager).

 

boss_of (Boss,Worker) :- works_for (Worker, Boss).

 

under (Worker, Boss) :- works_for (Worker,Boss).

under (Worker, Boss) :- works_for (Worker, Worker2), under (Worker2,Boss).

 

 

 

1.        Which version of Prolog are you using?                                                                   (2)

 

 

 

2.       How do you indicate a comment in your version of Prolog?                                       (2)

 

 

 

 

3.       What will be returned by the query   works_for (stenographer, Who).  ?                                                                                                                                           (2)

 

 

4.       Why did you get the answer you got for question 2?                                                (2)

 

 

 

5.       What will be returned by the query  works_for (Worker, finance_officer).  ?                                                                                                                                               (2)

 

 

 

 

6.       What will be returned by the query  works_for (Who, production_manager).  ?              

                                                                                                            (2)

 

 

 

7.       Write the query that will tell who works for the director.                                        (2)

 

 

 

8.       Write the query that will show all the relations in the database.                              (2)