Prolog
Assignment
Due
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 called OfficePro.txt which, once you download it, you may will need to rename.
Rename it as OfficePro.pro Office.pro or OfficePro.pl Office.pl to be able to consult it. In PDProlog filenames
can't be longer than 8 characters plus a 3 character extension because it is an
old DOS program.
1.
Which version of Prolog are you using? (2)
A.D.A. or PDProlog 1.95D
SWI-prolog
2.
How do you indicate a comment in your
version of Prolog? (2)
/*
this is a comment */
3.
What will be returned by the query works_for (stenographer, Who). ? (2)
No.
4.
Why did you get the answer you got for
question 2 3? (2)
because there is no fact in the database with
stenographer as the first argument.
5.
What will be returned by the query works_for (Worker, finance_officer). ? (2)
Worker = clerk
More? (Y/N):y
Worker = cashier
More? (Y/N):y
No.
6.
What will be returned by the query works_for (Who, production_manager). ?
(2)
Who = sales_officer
More? (Y/N):y
Who = stores_manager
More? (Y/N):y
Who = publicity_officer
7.
Write the query that will tell who works
for the director. (2)
works_for
(Who, director). OR
boss_of (director,Worker).
8.
Write the query that will show all the relations in the database. (2)
Listing.