NPTEL Artificial Intelligence: Knowledge Representation And Reasoning Week 6 Assignment Answers 2025
1. Which of the following are Horn clauses?
- ¬R(?x,?y) ∨ ¬P(?x) ∧ Q(?y)
- ¬R(?x,?y) ∨ P(?x)
- P(?x) ∨ ¬Q(?y)
- ¬P(?x)
- ¬R(?x,?y) ∧ ¬P(?x)
- Null Clause
Answer :- For Answers Click Here
2. Select the true statements.
- Any CNF formula can be expressed as a set of Horn clauses.
- Any FOL formula can be expressed as a CNF formula.
- Any FOL formula can be expressed as a set of Horn clauses.
- A Horn clause program is a CNF formula.
- A Horn clause program is a FOL formula.
Answer :-
3. Which of the following sentences can be expressed as Horn clause programs?
S1: ((¬P ∨ ¬Q) ⊃ R) ∧ (¬S ⊃ R)
S2: ((¬P ∨ ¬Q) ⊃ ¬R) ∧ (S ⊃ R)
- Only S1
- Only S2
- Both S1 and S2
- Neither S1 nor S2
Answer :-
4. Which of the sentences in the previous question can be expressed in clause form?
- Only S1
- Only S2
- Both S1 and S2
- Neither S1 nor S2
Answer :-
5. Each option shows a pair of predicates expressed in SWI Prolog syntax. Identify the pairs that are unifiable.
- p(23); p(6);
- p(23); p(X*3);
- q(h(a,X),X); q(Y,h(b,c));
- r([a,f(a)],[Z,f(Z)]); r([X,Y],[f(X),f(Y)]);
- s([a,f(a)],[f(Z),Z]); s([X,Y],[f(X),f(Y)]);
Answer :-
6. SLD resolution is the only proof method for Horn clauses.
- True
- False
- Cannot be determined
Answer :-
7. Consider the following program with four predicates p, q, r and s. Use SWI Prolog to study these predicates then answer the following questions. (See the Week 6 Practice Assignment for SWI Prolog installation instructions.)
p([],0).
p([H|T],N) :- p(T,M), N is M+H.
q([],0).
q([H|T],N) :- q(T,M), N = M+H.
r([],0).
r([H|T],N) :- r(T,M), N is M+1.
s([],0).
s([H|T],N) :- s(T,M), N = M+1.
Which of the following queries produce the same (identical) binding for Y?
- ?- p([4,2,-3],Y).
- ?- q([4,2,-3],Y).
- ?- r([4,2,-3],Y).
- ?- s([4,2,-3],Y).
Answer :- For Answers Click Here
8. Select the predicate that defines the length of a list L as a number N.
- ?- p(L,N).
- ?- q(L,N).
- ?- r(L,N).
- ?- t(L,N).
Answer :-
9. Select the predicate that defines the sum of the elements in a list L as a number N.
- ?- p(L,N).
- ?- q(L,N).
- ?- r(L,N).
- ?- t(L,N).
Answer :-
10. Consider the following program with four predicates p, q, r and s. Use SWI Prolog to study these predicates then answer the following questions. (See the Week 6 Practice Assignment for SWI Prolog installation instructions.)
p([],[]).
p([A|As],[A|Bs]) :- p(As,Bs).
q([],Bs).
q([A|As],[A|Bs]) :- q(As,Bs).
r(As,Bs) :- p(As,Bs).
r(As,[B|Bs]) :- r(As,Bs).
s(As,Bs) :- q(As,Bs).
s([A|As],[B|Bs]) :- s([A|As],Bs).
Which of the following query/queries return true?
- ?- p([1,2,3],[1,2,3,4,5]).
- ?- q([1,2,3],[1,2,3,4,5]).
- ?- r([1,2,3],[1,2,3,4,5]).
- ?- s([1,2,3],[1,2,3,4,5]).
Answer :-
11. Select the predicate that defines list X as a prefix of list Y. (For example, “EAR” is a prefix of “EARTH”.)
- p(X,Y)
- q(X,Y)
- r(X,Y)
- s(X,Y)
Answer :-
12. Select the predicate that defines list X as a sublist of list Y. (For example, “ART” is a substring of “EARTH”.)
- p(X,Y)
- q(X,Y)
- r(X,Y)
- s(X,Y)
Answer :- For Answers Click Here