PROLOG Flashcards

(15 cards)

1
Q

He is widely recognized as the creator of Prolog and drove its practical implementation for natural language processing.

A

Alain Colmerauer

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

The full phrase that the abbreviation “Prolog” stands for.

A
  • PROgrammation en LOGique
  • Programming in Logic
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are the three basic constructs used to build programs in Prolog?

A

facts, rules, and queries.

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

This specific symbol must be used at the end of every Prolog statement to terminate a clause or query.

A

( . ) (Period)

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

It is the combination of an atom and its arity used to name compound terms.

A

Functor

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

Prolog is classified as an imperative programming language because the programmer specifies exactly how to compute a result.

A

False (It is a Declarative Logic Programming language)

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

Variables in Prolog must always begin with an uppercase letter or an underscore (_).

A

True

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

Prolog uses traditional for and while loops to perform repetitive tasks.

A

False (Iteration is achieved through recursion)

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

The “Cut” operator, which is used to prevent backtracking, is represented by the exclamation mark symbol (!).

A

True

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

The standard file extension for Prolog source files is typically .pl or .pro

A

True

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

Given the query, what is the value of Tail?
?- [Head | Tail] = [jude, jona, kaye].

A

Tail = [jona, kaye]

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

Given the facts and rules, what query can invoke the output?

dog(ringgo).
dog(georgia).
owns(kaye, Pet):- dog(Pet).
loves(Who, What):- owns(Who, What).

A

Who = kaye,
What = ringgo ;
Who = kaye,
What = georgia

-? loves(Who, What)

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

Given the facts, what is the result of the query?

friend(ace, mark).
friend(mark, jude).

?- friend(ace, X), friend(X, jude).

A

X = mark

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

Given the facts and rules, what is the result of the query?

is_compsci(ace).
is_compsci(ecie).
is_nursing(alecs).
is_business(sophia).
not_compsci(X) :- + is_compsci(X).

?- not_compsci(sophia).

A

true

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

If a rule is defined as follows, what is the result of the query?

double(X, Y) :- Y is X * 2

?- double(10, Result).

A

Result = 20

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