Modern Programming Languages MCQs with Answers
Practice important Modern Programming Languages MCQs with answers and explanations.
Multiple Choice Questions
Q341: What does the sqrt function do in LISP?
- A: Finds the square of a number
- B: Finds the square root of a number
- C: Converts a number to string
- D: Rounds off a number
View Answer
B
Q342: Which type of elements does an S-expression contain in LISP?
- A: Lists only
- B: Atoms only
- C: Both atoms and lists
- D: None of the above
View Answer
C
Q343: What does the cons function do in LISP?
- A: Appends two lists
- B: Inserts an element at the start of a list
- C: Returns the length of a list
- D: Removes an element from a list
View Answer
B
Q344: Which function in LISP can create a list with arbitrary elements?
- A: cons
- B: append
- C: list
- D: first
View Answer
C
Q345: What does the append function do in LISP?
- A: Creates a list
- B: Appends one list to another
- C: Inserts an element
- D: Reverses a list
View Answer
B
Q346: In LISP, what does the first function return?
- A: The first element of a list
- B: The last element of a list
- C: The reversed list
- D: The length of a list
View Answer
A
Q347: What will (car '(A B C)) return?
- A: (A B)
- B: A
- C: NIL
- D: B
View Answer
B
Q348: What does (cdr '(A B C)) return in LISP?
- A: A
- B: (A B)
- C: (B C)
- D: C
View Answer
C
Q349: What does the length function in LISP do?
- A: Finds the number of elements in a list
- B: Removes duplicates from a list
- C: Appends two lists
- D: Checks for equality
View Answer
A
Q350: Which function checks if a value is a list in LISP?
- A: atom
- B: listp
- C: number
- D: symbolp
View Answer
B