Lisp Interview Questions For Freshers & Experienced

  • Question 1) Explain what is LISP?
  • Question 2) Who is founder of LISP programming Language?
  • Question 3) For what Lisp Programming is used?
  • Question 4) Explain LISP Machine (LISPM)?
  • Question 5) List few applications of LISP?
  • Question 6) What is CAR in LISP?
  • Question 7) What CDR in LISP program?
  • Question 8) How data types are categorized in LISP?
  • Question 9) What are predicates in LISP?
  • Question 10) What is CLOS in LISP?
  • Question 11) Explian use of macro in LISP?
  • Question 12) What is setq in LISP?
  • Question 13) How to create constant in Lisp?
  • Sharad Jaiswal
  • 31st Dec, 2019
  • 451 Followers

Lisp Interview Questions
Updated ON

31st Dec, 2019

No. of Questions

15

Posted In

Artificial Intelligence

Author

Sharad Jaiswal

What is Lisp?

Lisp is one of the oldest programming languages after Fortran. The most common Lisp dialects are Scheme and Common Lisp. Due to the presence of symbolic information, Lisp is suitable for all the programs of Artificial Intelligence. Lisp acts as a common language and can be extended for the implementation of a specific purpose. Programs that are executed through Lisp are not dependant on characteristics like word length.

Lisp is a design methodology that is interactive and easily extensible. It updates the programs and offers high class debugging. Objects, lists, vectors, arrays, structures, hash tables, and symbols are included in the Lisp.

Key Features of Lisp

Below are few major features of Lisp

Machine Independent

Object-oriented programming

Interactive development

Fast and Expressive

Multiparadigm

‎Dynamic‎ and ‎strong

Symbolic expressions

Rich Operators

Lambda expressions and function definition

Lisp Programming Language

Q1. Explain what is LISP?

LISP (List Processors) is the second oldest high-level programming language developed in 1958. It is influenced by Alonzo Church’s lambda calculus for mathematical notation in computer programs. The ideas for data structures, storage management, dynamic typic, recursion, and higher-order functions are originated from LISP. LISP was favored by the developers for Artificial Intelligence research. LISP has an easily recognizable syntax because of its code and data interchangeability. LISP also has support for Linked List data structures as the source code is developed from the list. Today, some of the well-known LISP dialects are Clojure, Common Lisp, and Scheme.

Q2. Who is founder of LISP programming Language?

LISP was developed in 1958 by John McCarthy at MIT (Massachusetts Institute of Technology).

Q3. For what Lisp Programming is used?

LISP is a common programming language that can be used for many types of applications. But it is mainly used in Artificial Intelligence research, Machine Learning, and other advanced learning concepts because of LISP’s recursive logic. AutoLisp, a subset of LISP is used for customizing AutoCAD and write Macros to automate steps.

Q4. Explain LISP Machine (LISPM)?

As the name implies, LISP machines are computers designed to run the LISP programs efficiently. Used in the ’60s and ’70s, the LISP machines were a replacement to standard computers than ran FORTRAN and assembly language program's efficiently but not LISP. LISP used tag bits to store additional information which was not handled efficiently by the standard computer architecture. So, the LISP machine was developed that has a computer architecture specifically made to handle tagged values in the LISP programs. They also had built-in instructions for dynamic dispatch, handling virtual memory, etc. This made LISP machines handle LISP software and programs efficiently.

Q5. List few applications of LISP?

The Two important applications of the LISP programming language are AutoCAD and Emacs.

  1. AutoCAD is a designing software where AutoLISP is used to create additional customization to the CAD environment. AutoLISP is a lightweight subset of LISP for customizing and adding additional features to the AutoCAD.
  2. The Emacs LISP is used to create and code the editing abilities of the GNU Emacs editor. Also called as Elisp, Emacs LISP is a dialect of LISP for customizing and adding capabilities to the GNU Emacs and other editors like XEmacs text editor.

Q6. What is CAR in LISP?

The LSIP programming language has a record structure called a con. It is nothing but a single linked list. In this list, the car is a function that is used to access the first value. The car function extracts the pointer of the first value in the linked list.

The expression (car (con x y)) returns the first value x.

Q7. What CDR in LISP program?

In LISP, the data types are categorized into two types.

Scalar Types – It has normal types such as integers, numbers, characters, symbols, etc.

Data Structures – It has complex types such as linked list & other lists. Vectors, bit-vectors, strings, etc.

Q8. How data types are categorized in LISP?

The Predicates in LISP are functions that test specific conditions on their parameters. It returns non-nil, if the condition is true, or nil if it is false.

Here are some of the predicates in LISP,

  • Atom – It checks the argument and returns t if it is atoms or nil.
  • Equal – It checks if two arguments are equal and return t if it is. It returns nil if it is not equal.
  • Zerop – it checks if the argument is zero and returns t. It returns nil otherwise.
  • Null – it returns t if the argument is nil or it returns nil.

Q9. What are predicates in LISP?

The Predicates in LISP are functions that test specific conditions on their parameters. It returns non-nil, if the condition is true, or nil if it is false.

Here are some of the predicates in LISP,

  • Atom – It checks the argument and returns t if it is atoms or nil.
  • Equal – It checks if two arguments are equal and return t if it is. It returns nil if it is not equal.
  • Zerop – it checks if the argument is zero and returns t. It returns nil otherwise.
  • Null – it returns t if the argument is nil or it returns nil.

Q10. What is CLOS in LISP?

CLOS (Common Lisp Object System) is a powerful object-oriented system that was adopted for Common Lisp as part of ANSI Standard. CLOS has support for classes, its methods, class instance, and generic function. A class can have multiple superclass, slots, and metaclass in CLOS. Also, the methods in CLOS can be grouped into generic functions. It is a multiple dispatch system where the methods are specialized upon their required arguments.

CLOS is a dynamic object-oriented system and is also different from common object-oriented languages such as Java or C++.

Q11. Explian use of macro in LISP?

Macros in LSIP are just a function that is used to define the syntax extension to LISP. Macros transform the LISP code. The macro function takes its arguments as s-expression and it returns the LISP form for it. LISP macros are also used to do things like adding syntactic sugar, build pieces of a program during compile time, generate code, etc. You can define your Macro by using the keyword defmacro.

//syntax
(defmacro macro-name (parameter-list)) body-form

Q12. What is setq in LISP?

The setq is a construct that is used to set a value for a symbol since there is no type declaration available in LISP.

//example
(setq x 30)

The above expression assigns the value of 30 to the variable x and you can refer the value using the variable ‘x’ in any expression.

Q13. How to create constant in Lisp?

Constants are just variables whose values cannot be changed throughout the program execution once it is assigned. To define a constant in LISP, use def constant construct.

//example
(defconstant x 3)

Here x is declared a constant and assigned with 3 whose value will not change throughout the program execution.

Q14. What is Common Lisp?

The Common Lisp is a dialect of LISP that was developed as a successor to Maclisp. It is a language specification that is sought to unify and standardize the features of Maclisp dialects. It is a dynamically typed language, general-purpose, multi-paradigm programming language with the file extensions of .lisp, .lsp, .l, .cl, .fasl. It has support for functional, procedural, and object-oriented paradigms. It also includes support for CLOS and Macros.

Q15. Write a hello world program in lisp?

The format keyword is used to print values in LISP like printf in C.

//Program for Hello world
(format t "Hello, World!")

About Author :

  • Author of Lisp Interview Questions

    Sharad Jaiswal

    Sharad Jaiswal is Sr. Web Developer from Noida area. He have rich experience in PHP, Angular Js, React, javascript and Node .If you any query or project on these programming you can drop your enquiry in comment section.

Leave A Comment :

Valid name is required.

Valid name is required.

Valid email id is required.