Explain what is the difference between bagof/3 and setof/3 predicate in Prolog?
Answer / chaitanya
Setof/3 is similar to bagof/3 and the difference between is that bagof/3 leaves all repeated solutions while setof/3 removes them.
Is This Answer Correct ? | 0 Yes | 0 No |
What is the general pattern that shows how the various parts of an expression fit together? a) Template b) Pattern c) Match d) Both a & b
Explain why matching variable is important in Prolog? What is the method to match variables?
Mention what is the difference between = and = = in Prolog?
Which process helps to build large and complicated programs in LISP? a) Macros b) Procedure abstraction c) Defun d) None
What is the output of the following statement? * (setf p .6) * (cond ((> p .75) ‘very-likely)((> p .5) ‘likely)((> p .25) ‘unlikely)(t ‘very-unlikely)) a) Very-likely b) Likely c) Unlikely d) Very-unlikely
What is the output of the given statement in LISP? * (setf abc ‘(a b c) xyz ‘(x y z)) * (setf bc (rest abc)) * bc a) A b) B c) C d) BC
Which do not evaluate their arguments in LISP? a) List b) Procedure c) Setf d) Macros
What is the output of the given statement? * (defstruct person (sex nil) (personality ‘nice)) * (setf person-instance-1 (make-person)) * (setf person-instance-2 (make-person :sex ‘female)) a) Person :sex female :personality nice b) Person :sex c) Sex:Female d) None of the mentioned
Which exploit the fact that lisp forms are just expressions meant to be evaluated? a) List b) Procedure c) Macro d) None of the mentioned
Which is used to represent the prompt in lisp? a) # b) $ c) & d) *
What is the output of the following statement? * (defun make (title author) (list (list ‘title title) (list ‘author author))) * (setf book (make ‘(Common Lisp) ‘(Guy steele))) a) Common Lisp b) Guy steele c) Make d) ((TITLE (COMMON LISP)) (AUTHOR (GUY STEELE)))
What is the output of the given statement in LISP? * (setf abc ‘(a b c) xyz ‘(x y z)) * abc a) A b) B c) ABC