Prolog Part 1

Ace your homework & exams now with Quizwiz!

In Prolog, a program consists of:

All of the above

Facts declare things that:

Are always true

In Prolog, a fact is:

Clause that has a head and an empty body

Which of the following are clauses in Prolog?

Fact, Rule, Question

Rules are clauses with a body but without a head.

False

In rules, goals could be separated by commas.

True

Consider the following relation: loves(john, ann). loves(ted, mary). loves(marc, liza). loves(ann, ted). loves(liza, marc). Select all possible answers to the following question (finding some of them might require typing a semicolon and backtracking): ?-loves(X, Y), loves (Y,X).

X = marc Y = liza, X = liza Y = marc

Consider the following relation: loves(john, ann). loves(ted, mary). loves(marc, liza). male(john). What is the answer to the following question: ?-loves(X, mary), male (X).

false

Consider the following relation: loves(john, mary). loves(ted, mary). loves(marc, mary). What is the answer to the following question: ?-loves(X, liza).

false

A variables scope

is in the clause in which it appears.


Related study sets

Level 2 non-commissioned security officer

View Set

Chapter 1-1 Laws and Legal Systems

View Set

Google Ads Creative Certification

View Set

ACC 455 - Chapter 6 - Audit Responsibilities and Objectives

View Set

Homework Questions for Biochem final

View Set

Term 3 OB I Quiz 2 Labor and Birth, Care of Women with Complications during Labor and Delivery

View Set