Skip to main content

Modern Programming Languages MCQs with Answers

Practice important Modern Programming Languages MCQs with answers and explanations.

Chapter: 18
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
Correct Answer: B
Chapter: 18
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
Correct Answer: C
Chapter: 19
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
Correct Answer: B
Chapter: 19
Q344:
Which function in LISP can create a list with arbitrary elements?
A. cons
B. append
C. list
D. first
Correct Answer: C
Chapter: 19
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
Correct Answer: B
Chapter: 19
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
Correct Answer: A
Chapter: 19
Q347:
What will (car '(A B C)) return?
A. (A B)
B. A
C. NIL
D. B
Correct Answer: B
Chapter: 19
Q348:
What does (cdr '(A B C)) return in LISP?
A. A
B. (A B)
C. (B C)
D. C
Correct Answer: C
Chapter: 19
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
Correct Answer: A
Chapter: 19
Q350:
Which function checks if a value is a list in LISP?
A. atom
B. listp
C. number
D. symbolp
Correct Answer: B
Chapter: 19
Q351:
What is the result of (reverse '(A B C))?
A. (C B A)
B. (A C B)
C. (A B C)
D. NIL
Correct Answer: A
Chapter: 19
Q352:
Fill in the blank: In LISP, (union '(A B) '(B C)) returns ____.
A. (A B)
B. (A B C)
C. (B C)
D. (C A)
Correct Answer: B
Chapter: 19
Q353:
What will (intersection '(A B) '(B C)) return?
A. (A)
B. (A C)
C. (B)
D. (A B)
Correct Answer: C
Chapter: 19
Q354:
Which predicate checks if a value is an atom in LISP?
A. atom
B. listp
C. number
D. null
Correct Answer: A
Chapter: 19
Q355:
Fill in the blank: (setq L '(A B C)) makes L equal to _____.
A. (A B)
B. (A B C)
C. NIL
D. (B C)
Correct Answer: B
Chapter: 19
Q356:
What is the output of (member 'B '(A B C))?
A. (B C)
B. (A B C)
C. NIL
D. (A C)
Correct Answer: A
Chapter: 19
Q357:
What does (set-difference '(A B) '(B C)) return?
A. (A)
B. (B)
C. (A C)
D. NIL
Correct Answer: A
Chapter: 19
Q358:
What does (setq L '(A B C)) define?
A. A variable with the value of a list
B. A function in LISP
C. A predicate
D. A constant
Correct Answer: A
Chapter: 19
Q359:
What is the result of (listp '(A B C))?
A. NIL
B. T
C. (A B C)
D. (B C)
Correct Answer: B
Chapter: 20
Q360:
What does the defun keyword in LISP define?
A. A variable
B. A function
C. A loop
D. A list
Correct Answer: B

Test Your Knowledge

Take a timed quiz on Modern Programming Languages

🚀 Start Quiz Now