Explain with an example what is “Setof” predicate in Prolog?



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

Post New Answer

More AI Languages Interview Questions

 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

1 Answers  


 Explain LISP-Vectors?

1 Answers  


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

1 Answers  


 How many items are available in mapping primitives are there? a) 3 b) 4 c) 5 d) 6

1 Answers  


Explain what is backtracking in Prolog?

1 Answers  






 Which can be represented in bytes in LISP? a) Boxes and pointers b) Lists c) Lisp d) None of the mentioned

1 Answers  


 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

1 Answers  


Mention what is the difference between Prolog and normal programming language?

1 Answers  


Demonstrate with an example how you can code in LISP?

1 Answers  


 Explain what is the importance of the hash table in LISP?

1 Answers  


 Explain what is prolog programming language? What is it based on?

1 Answers  


 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))))))

1 Answers  


Categories
  • AI Algorithms Interview Questions AI Algorithms (74)
  • AI Natural Language Processing Interview Questions AI Natural Language Processing (96)
  • AI Knowledge Representation Reasoning Interview Questions AI Knowledge Representation Reasoning (12)
  • AI Robotics Interview Questions AI Robotics (183)
  • AI Computer Vision Interview Questions AI Computer Vision (13)
  • AI Neural Networks Interview Questions AI Neural Networks (66)
  • AI Fuzzy Logic Interview Questions AI Fuzzy Logic (31)
  • AI Games Interview Questions AI Games (8)
  • AI Languages Interview Questions AI Languages (141)
  • AI Tools Interview Questions AI Tools (11)
  • AI Machine Learning Interview Questions AI Machine Learning (659)
  • Data Science Interview Questions Data Science (671)
  • Data Mining Interview Questions Data Mining (120)
  • AI Deep Learning Interview Questions AI Deep Learning (111)
  • Generative AI Interview Questions Generative AI (153)
  • AI Frameworks Libraries Interview Questions AI Frameworks Libraries (197)
  • AI Ethics Safety Interview Questions AI Ethics Safety (100)
  • AI Applications Interview Questions AI Applications (427)
  • AI General Interview Questions AI General (197)
  • AI AllOther Interview Questions AI AllOther (6)