Lisp Interview Questions

Lisp Interview Questions | Freshers & Experienced

  • Satyam Jaiswal
  • 24th Feb, 2021

Key Features of Lisp

Below are few major features of Lisp


Design Methodology

Easy extensibility

Programs Dynamically

High-level Debugging

Object-oriented programming

LISP Interview Questions

Q1. What is LISP?

LISP (LISt Processor) is the second-oldest high-level programming language that is still used today. It was first created as a practical mathematical notation for computer programs, but LISP soon became the favored programming language for Artificial Intelligence research. It was designed by John McCarthy.

LISP founded many ideas in computer science such as data structures, automatic storage management, dynamic typing, higher-order functions, recursion, self-hosting compiler, conditionals and more. The source code of the LISP is made up of linked list data structures as they are the major data structures in LISP. Released in the year 1958, LISP is a multi-paradigm, functional, and procedural programming language.

Q2. Who is the Founder of LISP Programming?

John McCarthy is the founder and developed LISP in 1958. He developed it when he was at the MIT (Massachusetts Institute of Technology).

Q3. Enlist few popular applications built in LISP?

Some of the popular applications built with LISP are,

  • Emacs editor - It is a code editor that is largely written in LISP except for a few small parts written in C.
  • Interleaf - It is a document processing system that can process millions of pages.
  • AutoCAD - It is designing software that uses LISP as its scripting software.
  • NoteCards - One of the early hypertext systems. Microsoft Bob - A software that provides a user-friendly interface for the Windows system.

Q4. For what LISP programming is used for?

LISP can be used for building any type of application, but it is the preferred language for building applications related to Artificial Intelligence, Machine Learning, and other kinds of advanced programming that uses recursive logic.

LISP is also used to customize AutoCAD, and write macros to automate steps.

Q5. How many types of arguments are available in LISP?

The arguments in the LISP are the specific data that you pass to a function to do some process. The arguments to a function can be a fixed number of arguments or an arbitrary number of arguments.

Q6. What is Local Variables in Lisp?

The local variables are the variables that are defined within a given procedure. These variables don’t have scope outside the procedure in which it is defined. Parameters and arguments defined within a function definition are also called as local variables. These parameters don’t have scope outside the function definition. Local variables can be created using the setq, let, and prog constructs.

//example of creating local variables
(let ((variable1 value1)))

Q7. What is a constant in Lisp?

Like in other programming languages, constants in LISP never change their values during the program execution. They are declared using the defconstant construct.

//example of defining a constant
(defconstant pi 3.14)
Here, the ‘pi’ is a constant and its value will never change throughout the execution of the program.

Q8. What is predicate in LISP?

The function used in the system to make the condition false and right is called predicate. It checks the condition for any argument and reverses with false and true conditions based on the result of the discussion.

Q9. What are LISP Vectors?

Lisp Vectors are generally called as one-dimensional arrays. Vectors work as sequences with lists to make the system of data more accessible.

Q10. What is slot in LISP?

The slots in LISP are the data that is used to store data or fields. The slot-description is used to define a slot. The slot-description has the form (slot-name slot-option).

The slot-option is followed by the name, expression, and other options. Commonly used slot options are :accessor, :initform, :initarg.

Q11. What is LG3,How to pass commands to LG3?

The LG3 in the LISP is the code generator. In LISP programming, LG3 is used to generate code that is easy to run.

The commands can be passed to the LG3 by selecting the general operations from the menu option in the LG3.

Q12. What is CLOS in LISP?

CLOS is a conventional lisp object system. It is robust object-oriented programming used for any kind of programming language starting from C, C++, etc.

Q13. Which symbol is used to represent the prompt in LISP?

The ">" symbol is used to represent a prompt. You should type after the prompt symbol in the lisp interpreter.

Q14. Which notation facilitates uniformity in LISP?

The prefix notation is used to facilitate uniformity in LISP. LISP defines their entire syntax in prefix notation as it can be readily parsed into an abstract syntax tree. The prefix notation has seen a wide application in the LISP s-expressions. Here, the brackets are required as the operators in the language are data.

Q15. What are the number types supported by LISP?

The number of data types in the LISP can be divided into two types. They are Scalar types and Data Structures.

  1. The Scalar types are called primitive types which include integer, float, cons, symbol, string, vector, subr, byte-code function, etc.
  2. The Data Structures are the complex types which include lists, vectors, bit-vectors, and strings.

Q16. What is LISP Machine (LISPM)?

LISP machines are designed to run LISP loaded software. These machines are for heavy usage and can be used in a concern to work and test efficiently.

Q17. What is macro in LISP?

Macros in the LISP are used to extend the syntax of the LISP. They are just a function that takes an s-expression as input arguments and returns a LISP form. Macros are defined using the construct defmacro. The macro definition consists of the name of the macro, a parameter list, an optional documentation string, and the body of the LISP expression. The LISP expression defines the job that is to be performed by the macro.

//syntax for creating a macro
(defmacro macro-name (parameter-list))
"Optional documentation string."

Q18. Enlist types of variables available in LISP?

Variables are used to store a value and it is represented by a symbol in LISP. There are two types of variables available in LISP. They are the Global variables and Local variables.

Global variables have the scope throughout the program and they have permanent values throughout the LISP system until a new value is specified to it. They are declared using the defvar construct.

//example of declaring global variables
(defvar x 1) //here ‘x’ is a global variables.

Local variables are defined within a function or procedure and have scope within the function. They can be created using the setq, let, or prog construct.

//example of declaring local variables
(let (variable1 value 1))

Q19. Write a program in LISP to print "Hello World"?

We can write a program in LISP to print "Hello World"

//hello world program in LISP
(format t "Hello, World!")

Here, the format statement is used to print. It is equivalent to the printf statement in the C program.

Q20. What is setq in LISP?

The setq construct is used to assign a value to the variables. It takes a symbol as a variable and assigns it value. Setq is the simple variable assignment statement in the LISP.

//syntax for setq
(set1 var1 val1 var2 val2 ...)

Here, the var1, var2 are the variables, and val1, val2 is the values assigned to the variables.

Q21. What syntax is used to create a sequence in LISP?

The make-sequence function is used to create a sequence of any type.

//syntax for creating sequence
make-sequence sqtype sqsize &key :initial-element

The sqtype is the type and the sqsize is the length of the sequence. You can also specify some optional values using the :initial-element argument. So each of the elements will be initialized to this value.

Q22. 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.

Q23. What is 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.

Q24. 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.

Q25. Explian use of macro in LISP?

Macros in LISP 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.

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

Q26. 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.

Q27. 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!")

Q28. List some library for NLP?

Some of the popular NLP libraries are,

NLTK (Natural Language Toolkit) - Probably the most popular NLP library used by millions of developers around the world. Written in python, it has all the functionalities and features to do Natural Language Processing.

SpaCY – An optimized NLP library available in python and CPython. The programs written in spaCY can be easily integrated with deep learning frameworks such as TensorFlow and PyTorch.

Pattern – A data mining library developed for python. It has various NLP tools to parse a variety of data sources from Google, Facebook, Twitter, etc.

TextBlob – Based on NLTK and Pattern the textblob has a good API for common NLP operations.

About Author :

  • Author of Lisp Interview Questions

    Satyam Jaiswal

    Satyam is digital marketing expert, blogger from Allahabad Area. He loves to write technical articles and programming blog. He works on Onpage Seo, Social Media Groups and Off page Profile building

Leave A Comment :

Valid name is required.

Valid name is required.

Valid email id is required.