Atoms are considered as S-expressions.
True
False
Answer and explanation
Atoms are also considered as S-expressions. Rather S-expressions are formed from atoms.
ObjectiveMcq
Print Protected
This page is protected for print. Use the website to view the content.
Atoms are considered as S-expressions.
True
False
Atoms are also considered as S-expressions. Rather S-expressions are formed from atoms.
If X and Y are S-expression then (X.Y) is a/an ____
S-expression
Atom
List
Predicate
In LISP programming if X and Y are S-expressions then the dotted pair (X.Y) is also considered as S-expression.
What are the basic building blocks of S-expressions?
Atoms
Lists
Numbers
Predicates
Atoms are building blocks of S-expressions. Even atoms are considered as a fundamental unit of LISP.
All program statements and data in LISP are represented by S-expressions?
True
False
Yes, all the program statements and data are represented by S-expressions in LISP. S-expressions or symbolic expressions are the syntactic elements of the LISP programming language.
What S-expression consists of?
Atoms and Lists
Numeric only
Literals only
Atoms only
S-expression consists of both Atoms and Lists. It also consists of numeric and literals.
Think of a way to write addition of four numbers using maximum possible braces?
(+ 1 2 3 4)
(+ (+ 1 2) (+ 3 4))
(+ 1 (+ 2 (+ 3 (4))))
(+ 1 2 (+ 3 4))
In this 3 times braces () are used. Other possible way is (+ 1 (+ 2 (+ 3 4))) in which again 3 braces () are used.
Can LISP programs be nested?
Yes
No
Yes, the LISP programs can be nested.
What is the basic syntax of LISP (Note: arg means argument here)
(<LISP Primitive> <arg1> <arg2> ...)
(<LISP Primitive> <arg>)
(<arg> <LISP Primitive>)
(<arg1> <arg2> ... <LISP Primitive>)
Correct syntax of the LISP is (<LISP Primitive> <arg1> <arg2> ...).
How many arguments do a single LISP program has?
One
Two
Any number of arguments
Three
Any number of arguments can come in LISP single program. As an example, the addition (+) primitive takes any number of arguments.
Arguments are ____ a part of LISP Syntax.
sometimes
always
vever
not considered as
Argument is a part of basic syntax of LISP. Even if there is no argument given then NIL is considered to be one of the arguments.
Which of the following is part of basic syntax in LISP programming?
Primitive
NULL
#include
Primitives are part of basic syntax of LISP. + is not considered as a part of basic syntax of LISP. It is rather an example of the primitives.
Choose correct statement about arg1 of setq syntax.
It is a list
It is a symbol in which value is stored
It is an arithmetic operator
It is a primitive
In (setq arg1 arg2), the arg1 is like a variable in which value is stored. It can be a symbol. The value of arg2 got stored in it.
What can be used as an argument for a primitive?
Atoms and List
Another LISP programs
A user-defined function
Atoms, List, Another LISP program, Used-defined function
These all can be used as an argument for a primitive. Arguments depend on the type of primitive used. Example for arithmetic operators: numbers are used. For list functions: lists are used.
What is the notation used for writing LISP Syntax?
Prefix
Infix
Postfix
Different notations for different LISP Primitives
Prefix notation is always used in LISP Syntax. It doesn't change for different LISP Primitives. That is infix and postfix notations are not used.
In the syntax (setf arg1 arg2), what is arg2?
A variable
A value to be set on arg1
It is the definition of arg1
A formula
In general, the arg2 or argument2 is the value that is to be set on arg1. It can be a number, a list, a symbol, a formula, etc.
In the syntax (setf arg1 arg2), what is arg1?
Value to be set
Variable on which value is set
Set of lists
Set of elements forming a list
The arg1 or argument 1 is like a variable in which value is stored. The arg1 can be anything like a symbol, a list or maybe the first element of a list, etc.
Does value of an actual parameter change in the procedure?
Yes
No
Sometimes
None of the mentioned
The value of the actual parameter does not change only when the name of actual and formal parameters is same. In all other cases, the value of the actual parameter can change.
Can the actual parameters and formal parameters be of same name?
Yes
No
Yes, the actual and formal parameters can be of same name. The scope of the formal parameter remains within the procedure in this case.
Can the parameters be passed to procedures in LISP?
No
Yes
Yes, the parameters can be passed to procedures. Parameter passing is the most important part of the procedures. Actual parameters are passed to the procedures while function invoking.