Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PROLOG multiple choice questions Please answer with full explanations 18. What is the following mystery/2 about? mystery([],[]). mystery([X|Y],Z) :- mystery(Y,W), takeout(X,Z,W). takeout(X,[X|R],R). takeout(X,[F|R],[F|S]) :- takeout(X,R,S).

PROLOG multiple choice questions

Please answer with full explanations

18. What is the following mystery/2 about? mystery([],[]). mystery([X|Y],Z) :- mystery(Y,W), takeout(X,Z,W). takeout(X,[X|R],R). takeout(X,[F|R],[F|S]) :- takeout(X,R,S).

A. append

B. prefix

C. permutation

D. reverse

E. suffix

F. member

G. sort

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. ==, \==

27. Complete the second clause of the following Prolog program for member/2 where member(X, Y) checks whether X is an element (a member) of a list Y. member(X,[X|R]). member(X,[Y|R]) :- ____________.

A. member(X,R).

B. member(X,Y).

C. member(_,R).

D. member(Y,R).

E. member(X,Y).

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

Advanced Database Systems For Integration Of Media And User Environments 98

Authors: Yahiko Kambayashi, Akifumi Makinouchi, Shunsuke Uemura, Katsumi Tanaka, Yoshifumi Masunaga

1st Edition

9810234368, 978-9810234362

Students also viewed these Databases questions