Quiz 6 Flashcards

(15 cards)

1
Q

T/F
Every logical statement can be turned into Horn clauses.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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]

A

[2, 3, 4]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

T/F
Changing the order of the right-hand side of a clause may cause an infinite loop in Prolog.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

T/F
Curry is dynamically typed, Prolog uses strong static typing with type inference,

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which predicate in Prolog can be used to force backtracking and to find all solutions to a query?

cut
write
append
fail

A

fail

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

T/F
Prolog queries always have one answer.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

T/F
If you have the fact human(bob) in Prolog, the query not(not(human(X))) returns X = bob.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

__________________________ 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

A

Occur-check problem

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

T/F
The language Curry brings together the advantages of functional and logic programming in a single language.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is implication operator in Prolog?

-:
=>
:-
=

A

:-

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

T/F
In logic programming, a statement is proved if all subgoals are eventually eliminated and the empty Horn clause is derived.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

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?

!
?
:-
;

A

!

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

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.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

T/F
Prolog’s search strategy is breadth-first search

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

T/F
In Prolog, any statement that is not known to be true is considered false.

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly