Quiz 6 Flashcards
(15 cards)
T/F
Every logical statement can be turned into Horn clauses.
False
What is the value of Y in Prolog if you write the following statement:
[X|Y] = [1,2,3,4].
4
[2, 3, 4]
1
[4]
[2, 3, 4]
T/F
Changing the order of the right-hand side of a clause may cause an infinite loop in Prolog.
True
T/F
Curry is dynamically typed, Prolog uses strong static typing with type inference,
False
Which predicate in Prolog can be used to force backtracking and to find all solutions to a query?
cut
write
append
fail
fail
T/F
Prolog queries always have one answer.
False
T/F
If you have the fact human(bob) in Prolog, the query not(not(human(X))) returns X = bob.
False
__________________________ refers to the issue that arises when a variable is unified with a term that contains that variable itself, leading to potentially infinite structures or circular references.
Nonmonotonic reasoning
Lazy evaluation
Negation as failure
Occur-check problem
Occur-check problem
T/F
The language Curry brings together the advantages of functional and logic programming in a single language.
True
What is implication operator in Prolog?
-:
=>
:-
=
:-
T/F
In logic programming, a statement is proved if all subgoals are eventually eliminated and the empty Horn clause is derived.
True
The cut operator is used to “cut” off parts of the search space, effectively preventing Prolog from backtracking past the point where the cut is encountered. Which of the following is the cut operator?
!
?
:-
;
!
T/F
writenum(l, J) :- num(X),
I =< X,
X =< J,
write(X),
nl,
fail.
For the given Prolog code, writenum(1,10) will go into an infinite loop after X = 10.
True
T/F
Prolog’s search strategy is breadth-first search
False
T/F
In Prolog, any statement that is not known to be true is considered false.
True