Quiz 6 Flashcards
Prolog’s search strategy is breadth-first search, T/F?
False
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, T/F?
False
What is the implication operator in Prolog?
:-, =, =>, or -:
:-
What is the value of Y in prolog if you write the following statement:
[X|Y] = [1,2,3,4,].
1, [4], [2,3,4], 4
[2,3,4]
Which predicate in Prolog can be used to force backtracking and to find all solutions to a query?
write, fail, append, or cut?
fail
________ 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.
Negation as failure, lazy evaluation, occur-check problem, nonmonotonic reasoning
Occur-check problem
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?
;, !, :-, or ?
!
In Prolog, any statement that is not known to be true is considered false, T/F?
True
Every logical statement can be turned into Horn Clauses, T/F?
False
In logic programming, a statement is proved if all subgoals are eventually eliminated and the empty Horn Clause is derived, T/F?
True
If you have the fact human(bob) in Prolog, the query not(not(human(x)) returns X = bob, T/F?
False
Curry is dynamically typed, Prolog uses strong static typing with type inference, T/F?
False
Changing the order of the right-hand side of a clause may cause an infinite loop in Prolog, T/F?
True
The language Curry brings together the advantages of functional and logic programming in a single language, T/F?
True
Prolog queries always have an answer, T/F?
False