Explain with an example what is “Setof” predicate in Prolog?
Answer / chaitanya
In Prolog, “Setof” predicate can be used to find out all the solutions of a predicate. For example, you have this database:
Guru99 (SAP, Testing Tools)
Guru99 (PHP, Perl)
And if you want to find the solutions of Guru99 (X, Y). We can enter
Setof ([ X,Y] , Guru99 (X,Y), Z).
Z = [[ SAP , Testing Tools], [ PHP, Perl] ]
Is This Answer Correct ? | 0 Yes | 0 No |
What is the output of the given statement in LISP? * (Setf part-bins (make-array ‘(4))) * (setf (aref part-bins 0) ‘nails); * (setf (aref part-bins 1) ‘nuts); * (setf (aref part-bins 2) ‘bolts) * (setf (aref part-bins 3) ‘bike) * (aref part-bins 2) * (setf (aref part-bins 4) ‘car) a) Nails b) Nuts c) 2 d) Error
Explain LISP-Vectors?
What will happen if the value of all the test-forms are nil? a) Nothing b) COND form is nil c) Both a & b d) None of the mentioned
How many items are available in mapping primitives are there? a) 3 b) 4 c) 5 d) 6
Explain what is backtracking in Prolog?
Which can be represented in bytes in LISP? a) Boxes and pointers b) Lists c) Lisp d) None of the mentioned
What is a symbol thought of as a name for a place to store value? a) Data b) Variable c) Parameters d) None of the mentioned
Mention what is the difference between Prolog and normal programming language?
Demonstrate with an example how you can code in LISP?
Explain what is the importance of the hash table in LISP?
Explain what is prolog programming language? What is it based on?
What is the output of the following statement? * ‘(first (first (rest (rest ((a b) (c d) (e f)))))) a) a b) b c) ab d) (FIRST (FIRST (REST (REST ((A B) (C D) (E F))))))