Vidyalelo
Artificial Intelligence · Q17

Artificial Intelligence

Computer Related · Artificial Intelligence · question 17

Q17

In LISP, the function returns t if is a CONS cell and nil otherwise:

A.
(cons)
B.
(consp)
Answer
C.
(eq)
D.
(cous =)
E.
None of the above

Answer: Option B

Solution

Answer: Option B
Solution:
In LISP, the function used to determine whether an object is a CONS cell (a fundamental data structure in LISP representing a pair of values) is (consp). This function returns t if the object is a CONS cell and nil otherwise.
Option A: (cons) is a function used to create a CONS cell.
Option C: (eq) is a function used to test for equality between two objects.
Option D: (cous =) is not a valid LISP function.
Therefore, the correct function to return t if an object is a CONS cell and nil otherwise is Option B: (consp).