Explain why matching variable is important in Prolog? What is the method to match variables?
Answer / chaitanya
In Prolog, in order to process the elements of a list, we have to match them to variables. The method for doing is
We get the head by matching it to a variable
By calling a predicate with the variable, it processes the head
Until you get an empty list repeat the above steps
| Is This Answer Correct ? | 2 Yes | 0 No |
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)) * (person-personality person-instance-2) a) Female b) Nice c) Person d) Both a & b
Which keyword is used to construct an array in LISP? a) Array b) Make-array c) Bins d) Make
Which hides details behind abstraction boundaries? a) Procedures b) Procedure abstraction c) Recursion d) Both a & b
What is the programming structure for LISP?
Which forms can be constructed with the same primitives that manipulate lisp expressions? a) Lisp b) Macro c) Procedure d) Defun
Mention who is referred as a Member in Prolog?
Which makes it easy to identify the first entry encountered that satisfies a given predicate? a) Reusing b) Revoking c) Template d) Filtering
Explain what is SWI-Prolog?
Which makes it possible to define generic functions? a) Lisp b) CLOS c) Class d) Object-Oriented programming
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))) * (defun book-author-writer (book author) (cons (list ‘author author) book)) a) Book b) Book-author c) Book-author-writer 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
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)))
AI Algorithms (74)
AI Natural Language Processing (96)
AI Knowledge Representation Reasoning (12)
AI Robotics (183)
AI Computer Vision (13)
AI Neural Networks (66)
AI Fuzzy Logic (31)
AI Games (8)
AI Languages (141)
AI Tools (11)
AI Machine Learning (659)
Data Science (671)
Data Mining (120)
AI Deep Learning (111)
Generative AI (153)
AI Frameworks Libraries (197)
AI Ethics Safety (100)
AI Applications (427)
AI General (197)
AI AllOther (6)