Lisp Programming Interview Questions and Answers
Q1. What is Lisp Programming ?
Ans: Lisp is the second one-oldest excessive-degree programming language after Fortran and has changed a incredible deal when you consider that its early days, and a number of dialects have existed over its history. Today, the most widely recognized popular-motive Lisp dialects are Common Lisp and Scheme.
Lisp become invented by means of John McCarthy in 1958 even as he changed into on the Massachusetts Institute of Technology (MIT).
Q2. Why use LISP?
Ans: In short, no single improvement you can make for your AutoCAD device will prevent extra time, effort, and money. You can spend heaps on the state-of-the-art technology computers, the quickest video playing cards, and so on, but that may not make almost as huge a distinction as automating your device with software. With an arsenal of LISP exercises, you will ship accuracy, consistency, and productiveness hovering at the same time as substantially lowering the strain and pressure of CAD operation. The right software is the key, and there's no quantity of software program you can buy that beats being capable of application AutoCAD yourself with as many tailored workouts as you want. And that is precisely what the LISP Generator permits you to do.
Q3. Why LISP is used for Artificial Intelligence?
Ans: LISP is used for Artificial Intelligence for following reasons
It helps the symbolic programming, and old AI turned into primarily based on symbols
LISP is robust. The code or records distinction is weaker, so it feels extra extensible than different programming languages which make it feels like a domain particular language
It is an extraordinary prototyping tool and good at tackling issues
Q4. What is a "Lisp Machine" (LISPM)?
Ans: A Lisp machine (or LISPM) is a computer which has been optimized to run lispefficiently and offer an awesome surroundings for programming in it. The original Lisp machines were implemented at MIT, with spinoffs as LMI (defunct) and Symbolics (bankrupt). Xerox additionally had a sequence of Lisp machines (Dandylion, Dandytiger), as did Texas Instruments (TI Explorer). The TI and Symbolics Lisp machines are presently available as playing cards that fit into Macintosh computer systems (the so-known as "Lisp on a chip").
Optimizations standard of Lisp machines encompass:
- Hardware Type Checking. Special type bits allow the sort be checked
effectively at run-time.
- Hardware Garbage Collection.
- Fast Function Calls.
- Efficient Representation of Lists.
- System Software and Integrated Programming Environments.
Q5. What is the "minimum" set of primitives wished for a Lisp interpreter?
Ans: Many Lisp functions can be described in terms of different Lisp features.
For example, CAAR may be defined in terms of CAR as (defun caar (list) (vehicle (automobile listing))) It is then herbal to ask whether or not there is a "minimum" or smallest set of primitives vital to put into effect the language.
There is no single "quality" minimum set of primitives; all of it depends at the implementation. For example, even some thing as fundamental as numbers want no longer be primitive, and may be represented as lists. One viable
set of primitives may consist of CAR, CDR, and CONS for manipulation of S-expressions, READ and PRINT for the input/output of S-expressions and APPLY and EVAL for the heart of an interpreter. But then you definately would possibly need to add LAMBDA for features, EQ for equality, COND for conditionals, SET for project, and DEFUN for definitions. QUOTE would possibly come in handy as properly. If you add greater specialised datatypes, which includes integers, floats, arrays, characters, and structures, you will need to feature primitives to construct and get admission to each.
AWKLisp is a Lisp interpreter written in awk, to be had with the aid of anonymous ftp from ftp.Cs.Cmu.Edu:/user/ai/lang/lisp/impl/awk/. It has 13 integrated functions: CAR, CDR, CONS, EQ, ATOM, SET, EVAL, ERROR, QUOTE,COND, AND, OR, LIST.
Q6. How records kinds are classified in LISP?
Ans: In LISP, information sorts are categorised as
Scalar Types: Number types, Characters, Symbols, and many others.
Data Structure: listing, vectors, bit-vectors and strings
Q7. What is the programming structure for LISP?
Ans: LISP programming shape consists of symbolic expressions or s-expressions. The s-expression includes 3 valid gadgets
Atom: It is more than a few or string of contiguous characters
Lists : A list is a sequence of atoms or different lists enclosed in parentheses
String: A group of characters enclosed in double citation marks is referred as String.
LISP applications can be both run on an interpreter or as a compiled code
Q8. What if I get interrupted?
Ans: You are free to come and cross from the LISP Generator and do whatever you need in AutoCAD while you're in the center of creating a software. There are useful equipment in case you neglect things just like the names of variables you described.
Q9. Can I shop my packages to documents?
Ans: Yes, simply, and the files are widespread LISP code so as to run on any AutoCAD gadget.
Q10. How to pass commands to LG3?
Ans: By selecting standard operations from the tools menu. You can consider the gear as building blocks - every device similar to numerous traces of LISP code. The gear you operate and the order in which you pick out them defines what your software does.
Q11. Explain what is slot and what are the maximum generally used slot options?
Ans: Slots are nothing but variables that shops data or fields. A slot description has the form, where each alternative is a keyword observed through name, expression and different options.
The most commonly used slot options are:
Q12. Explain What Is The Ouput Like?
Ans: LG3 writes easy-to-examine, fully indented AutoLISP packages loaded with specified feedback in English that specify what all the LISP code is doing. The documents are fashionable “.LSP” documents. You can view, edit, or print them with any editor, and run them on any AutoCAD gadget without or with the Generator.
Q13. Is it possible to call LISP capabilities from different languages?
Ans: LISP gives a “call-back” function, while programmer friends a foreign language characteristic call with a LISP feature, it's miles connected with these name-back capabilities. With overseas function programmer need to supply the end result facts sorts and argument, in order that LISP may carry out conversions at the interface.
Q14. Mention what are the 3 functions required by means of LISP?
Ans: For defining capabilities, macro named defun is used, it wishes three arguments
Name of the function
Parameters of the characteristic
Body of the characteristic
Q15. What is REPL in context of Node?
Ans: REPL stands for Read Eval Print Loop and it represents a pc environment like a window console or unix/linux shell wherein a command is entered and device responds with an output. Node.Js or Node comes bundled with a REPL environment. It performs the following preferred responsibilities.<
Eval - Takes and evaluates the statistics structure
Print - Prints the result
Loop - Loops the above command till consumer press ctrl-c two times.