Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PROLOG 20. Consider the following mystery/3 predicate. mystery(X,[X|R],R). mystery(X,[F|R],[F|S]) :- mystery(X,R,S). What is the result L of the following query: ?- mystery(1,[1,2,3], L). A. L=1

PROLOG

20. Consider the following mystery/3 predicate.

mystery(X,[X|R],R). mystery(X,[F|R],[F|S]) :- mystery(X,R,S).

What is the result L of the following query: ?- mystery(1,[1,2,3], L).

A. L=1

B. L=2

C. L=3

D. L=[2,3]

E. L=[1,1,2,3]

F. L=[1]

21. What is the result of the following query? ?- transpose([[1,2,3],[4,5,6],[7,8,9]], Ts).

A. Ts = [1, 4, 7].

B. Ts = [1, 4, 7], [2, 5, 8], [3, 6, 9].

C. Ts = [1, 4, 7, 2, 5, 8, 3, 6, 9].

D. Ts = [1, 2, 3, 4, 5, 6, 7, 8, 9].

E. Ts = [[1, 4, 7], [2, 5, 8], [3, 6, 9]].

F. Ts = [1, 2, 3].

22 Which of the following selections is correct? This ____ is to add a new fact or rule (clause).

A. args/3

B. assert/1

C. atom/1

D. clause/2

E. call/1

F. findall/3

G. functor/3

H. ground/1

I. op/3

J. retract/1, retractall/1

K. var/1

L. =, \=

M. ==, \==

23. What is the predicate ___ for the following query and its result? ?- ____(f(a,b),F,A). A = 2 F = f

A. args/3

B. assert/1

C. atom/1

D. clause/2

E. call/1

F. findall/3

G. functor/3

H. ground/1

I. op/3

J. retract/1

K. var/1

L. =, \=

M. ==, \==

24. What is the predicate ___ for the following query and its result? ?- ___(2,loves(richard, sarah), X). X = sarah

A. arg/3

B. assert/1

C. atom/1

D. clause/2

E. call/1

F. findall/3

G. functor/3

H. ground/1

I. op/3

J. retract/1

K. var/1

L. =, \=

M. ==, \==

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Graph Databases

Authors: Ian Robinson, Jim Webber, Emil Eifrem

1st Edition

1449356265, 978-1449356262

More Books

Students also viewed these Databases questions