Quiz 6 Flashcards

1
Q

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

A

False

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

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?

A

False

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

What is the implication operator in Prolog?
:-, =, =>, or -:

A

:-

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

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

A

[2,3,4]

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?
write, fail, append, or cut?

A

fail

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
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.
Negation as failure, lazy evaluation, occur-check problem, nonmonotonic reasoning

A

Occur-check problem

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
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?
;, !, :-, or ?

A

!

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

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

A

True

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

Every logical statement can be turned into Horn Clauses, T/F?

A

False

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

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

A

True

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

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

A

False

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

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

A

False

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

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

A

True

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

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

A

True

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

Prolog queries always have an answer, T/F?

A

False

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