Get premium membership and access revision papers, questions with answers as well as video lessons.

Seit 111: Introduction To Logic  Question Paper

Seit 111: Introduction To Logic  

Course:Bachelor Of Information Technology

Institution: Kenyatta University question papers

Exam Year:2010



DATE: Friday 26th November, 2010

TIME: 2.00 p.m. – 4.00 p.m.

INSTRUCTIONS:

Answer Question One and any other two

QUESTION ONE

(a)
Explain the following terms:
(i)
Predicate.
(1 mark)
(ii)
Variable
(1 mark)
(iii)
Clause
(2 marks)
(iv)
Goal
(1 mark)


(b)
Give prolog statements that would be used to:
(i)
Load a prolog file
(ii)
Allow the user to input clauses directly
(iii)
Exit entry mode
(iv) List clauses
(4 marks)

(c)
Explain the use of the following statements in prolog:
(i)
Trace
(ii)
Spy
(4 marks)
Page 1 of 5


(d)
Differentiate between syntactic equality and semantic equality.
(2 marks)
(e)
What will be the output of the following queries? Explain your answers
(i)
?-2+2= 4.
(ii)
?-2==7-5.
(iii)
?6=:=4+2
(6 marks)

(f)
What is a list in logic programming?
(2 marks)
(g)
Consider the following knowledge base:


woman(mia).


woman(jody).


woman(yolanda).



loves(vincent.mia).


loves(Marcellus.mia).


loves(pumpkin,honey_bunny).


loves(honey_bunny,pumpkin).

Write query statements that would answer the following questions in a prolog
program. And give the likely answer to each of the questions.
(i)
Is Yolanda a woman?
(1 mark)
(ii)
Is there individuals who are women?
(1 mark)
(iii)
Who loves mia?
(1 mark)
(iv)
Is Vincent loved by anybody?
(2 marks)
(v)
Is Marcellus loved by Vincent?
(2 marks)

QUESTION TWO (20 MARKS)

(a)
With the use of an example, explain the following are implemented in prolog
program:
(i)
Disjunction

(ii)
Conjunction
(4 marks)

(b)
Explain the process used by prolog in executing a goal:
(5 marks)

(c)
Give at least five four data types in prolog.
(2 marks)
Page 2 of 5

(d)
Write a clause that is used as a rule for checking whether a value is a natural number.

(2 marks)
(e)
Consider the knowledge base below:

Department (maths, science)

Department (biology, science)

Department (physics, science)

Department (accounting, business)

Department marketing, business)

Department (English, art)
a. Write interactive an program in prolog that prompts the user to enter the name of the
subject and the system responding by displaying the department that the subject
belongs to.


(5 marks)
(f)
State the modus ponens inference rule.
(2 marks)


QUESTION THREE (20 MARKS)

(a)
Give at least four areas of application for logic programming.
(2 marks)

(b)
Formalize the following sentences of natural language into predicate logic.
(i)
A bronze is better than nothing
(ii)
Nothing is better than bronze
(iii)
a bronze medal is better than a gold
(6 marks)

(c)
let F :? X
? Yp
? (X,Y) and G :? Y
?
Xp
? (X,Y).
(i)
Explain F and G in the natural language
(4 marks)
(ii)
Use F and G above State for each of the four formulas below whether it is
satisfiable or not, explain your answer for each case.
1. (F? G)
2. ( F
? ? G)
3. ? F
? ? G
? ?
4. (F? G
? )
(8 marks)


Page 3 of 5


QUESTION FOUR (20 MARKS)

(a)
Represent the following facts in prolog form:

(i)
Bill likes ice cream
(1 marks)
(ii)
Bill likes golf when he is hungry
(2 marks)
(iii)
John travels to London only by train
(2 marks)

(b)
Differentiate between the following two statements:

(i)
member (X,[X|T]) and member(X,[H|T]):-member(X,T).
(4 marks)
(ii)
Express the following statements in prolog

a)
2+4= 6
b)
4+7= 11
(2 marks)
(c)
What is an arity?
(1 mark)
(d)
Write a predicate called myrepeat (X,Y) such that X is a list and Y is a list consisting
of every element of X repeated twice (e.g. ?-myrepeat ([a,me,e,d],Y). gives
Y=[a,a,me,me,4,4,d,d])
(5 marks)
(e)
Write a predicate mypredicate (X,List), which checks whether X is the
(i)
Head of the list
(ii)
Second element of the list
(iii)
Last element of the List
(3 marks)

QUESTION FIVE (20 MARKS)

(a)
Consider the knowledge base

woman (mia).

woman (jody).

woman (Yolanda).

man (mike)

person(X):- man(Xd);woman(X).

loves(X,Y):-knows(Y,X)

(i)
Differentiate the facts and the rules in this knowledge base
(2 marks)

Page 4 of 5


(b)
The following knowledge base is a family tree.

Mother(X):-woman(x), parent(X).

Father(X):-man(X),parent(X).

Child(X,Y):-parent(Y,X).


(i)
Explain in the natural language each of the rules in the knowledge base




(6 marks)
(ii)
Write a rule that would explicitly define the parent on the knowledgebase

(6 marks)
(iii)
Write a rule that would show the descendants or ancestors of an individual

(6 marks)
(iv)
Write rules that would be added to the knowledge base that can relate any two
individuals X and Y kin the following relationship type;
1. X is biological brother to Y
2. Y is an uncle of X
3. X is a grandchild of y
(6 marks)


============================================
Page 5 of 5






More Question Papers


Popular Exams



Return to Question Papers