Top 18 LISP Interview Questions & Answers

1) Explain what is LISP? Give an example of some of the popular applications built in LISP?

LISP stands for List Processing, it is also a high-level programming language based on formal functional calculus. This language is used for easy manipulation of data strings. It is used for Artificial Intelligence.

Some of the popular applications built in LISP are

• Yahoo Store
• AutoCad
• G2
• Emacs
• Igor Engraver

2) Why LISP is used for Artificial Intelligence?

LISP is used for Artificial Intelligence for following reasons

• It supports the symbolic programming, and old AI was based on symbols
• LISP is powerful. The code or data distinction is weaker, so it feels more extensible than other programming languages which make it feels like a domain specific language
• It is an excellent prototyping tool and good at tackling problems

3) Demonstrate with an example how you can code in LISP?

Almost everything in LISP is a function, even the mathematical operators.

For example, (+ (* 5 3) 1 )

The output will be 16, functions in LISP open and close with parenthesis.

4) What is the programming structure for LISP?

LISP programming structure is composed of symbolic expressions or s-expressions. The s-expression consists of three valid objects

• Atom: It is a number or string of contiguous characters
• Lists : A list is a sequence of atoms or other lists enclosed in parentheses
• String: A group of characters enclosed in double quotation marks is referred as String.
LISP programs can be either run on an interpreter or as a compiled code

5) How data types are categorized in LISP?

In LISP, data types are categorized as

• Scalar Types: Number types, Characters, Symbols, etc.
• Data Structure: list, vectors, bit-vectors and strings


6) Mention how many types of variables available is LISP? Explain what are the variables that are bound, and that have values assigned to them?

The number of variables available in LISP is two one is lexical variable, and other is special variable. The parameter of procedures is variable which are bound and have values allotted to them.

7) Explain what is Local Variables?

With a given procedure local variables are defined. The parameters named as arguments within a function are also referred as local variables. They are accessible only within the respective function.

8) Explain what is LISP constants?

In LISP, during execution constants are variables that never change their values. Using the defconstant construct constants are declared.

9) Is it possible to call LISP functions from other languages?

LISP provides a “call-back” function, when programmer associates a foreign language function name with a LISP function, it is linked with these call-back functions. With foreign function programmer must supply the result data types and argument, so that LISP may perform conversions at the interface.

10) Mention what are the three functions required by LISP?

For defining functions, macro named defun is used, it needs three arguments

• Name of the function
• Parameters of the function
• Body of the function

11) Explain what is a predicate in LISP?

Predicates are one type of functions that test their arguments for specific conditions and returns nil value if condition is false and if condition is true it retrieves some non-nil value.

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

The hash table data structure denotes a collection of key and value pairs which are arranged based on the hash code of the key. Each item in the hash table has key/value pair and is used to access the items in the collection. When you want to access elements by using a key a hash table is used.

13) Explain LISP-Vectors?

Vectors are one-dimensional arrays, therefore, a subtype of array. Vectors and lists together are called sequences. LISP has fixed length variable/ simple vectors as well as variable length vectors which are created with the keywords: adjustable and fill-pointer.

14) Explain what is the property list in LISP?

In LISP, a symbol represents a data-objects. It consists of component called Property list or plist. LISP enables to assign properties to symbols. A property list is executed as a list within an even numbers of elements.

15) Mention what are the two pre-defined packages used in LISP?

The two pre-defined packages in LISP are

• Common Lisp: It contains symbols for all the functions and variables defined
• Common Lisp User: It uses the common-lisp package and all other packages with editing and debugging tools

16) Explain what is slot and what are the most commonly used slot options?

Slots are nothing but variables that stores data or fields. A slot description has the form, where each option is a keyword followed by name, expression and other options.
The most commonly used slot options are:

• :accessor function-name
• :initform expression
• :initarg symbol

17) Explain what is CLOS in LISP? What are the goals of the common lisp object system?

For writing object oriented programs, common LISP includes a set of operators, collectively they are called CLOS or Common Lisp Object System.

The common objective of LISP is to

• To fit common lisp in a natural way, in terms of functional notation and extending common LISP type
• To provide a smooth growth path and easy transitions for current users of flavors and common loops
• To provide a layered approach
• To provide both platforms for the efficient delivery of applications and language for powerful programing environment

18) Explain what is setq is used for in LISP?

setq is used to set variables in LISP

1 reply

Leave a Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

  1. Jayalatha Sadanandan says:

    Wonderful LISP.