Шукаєте відповіді та рішення тестів для Course 28502? Перегляньте нашу велику колекцію перевірених відповідей для Course 28502 в moodle.royalholloway.ac.uk.
Отримайте миттєвий доступ до точних відповідей та детальних пояснень для питань вашого курсу. Наша платформа, створена спільнотою, допомагає студентам досягати успіху!
Consider the following Prolog knowledge base:
bird(tweety).bird(polly).penguin(pingu).can_fly(X) :- bird(X), \+ penguin(X). For each of the following queries, select all queries that fail (i.e., Prolog answers false.).Consider the following Prolog program:
p(a).p(b).q(a).q(b).r(X,Y) :- p(X), !, q(Y).What answers are produced by the following query?
?- r(X,Y).Consider the following Prolog program:
test(X,Y) :- ( X > 0 -> Y = positive ; Y = nonpositive ).
What value(s), if any, will be returned for Y by the following query?
?- test(3,Y).
The Prolog goal \+ Goal succeeds when Prolog cannot prove Goal.
Consider the following query:
?- setof(X, member(X,[b,a,c,a]), L).What is the value of ?L
Prolog is a typed language because it supports argument mode annotations. For example, in a predicate specification such as ancestor(+Person, ?Ancestor), +Person means that Person must be instantiated at the time of the call, and +Ancestor means that Ancestor may be either input or output.
Prolog is a functional programming language because programs consist of rules that define how outputs are computed from inputs.