Modern Programming Languages MCQs with Answers
Practice important Modern Programming Languages MCQs with answers and explanations.
Chapter: 21
Q381:
What is returned by dotimes when the optional result parameter is not provided?
A. The count variable
B. NIL
C. The last element of the loop
D. An error
Correct Answer:
B
Chapter: 21
Q382:
What does the function product-as-sum compute in LISP?
A. Multiplication using repeated addition
B. Division using loops
C. List concatenation
D. Sum of array elements
Correct Answer:
A
Chapter: 21
Q383:
What is the primary purpose of a property list in LISP?
A. To store variables
B. To assign and access properties
C. To create a symbol table
D. To define a new loop construct
Correct Answer:
B
Chapter: 21
Q384:
Which function in LISP removes a property from a property list?
A. remprop
B. setf
C. symbol-plist
D. delprop
Correct Answer:
A
Chapter: 21
Q385:
What data structure does LISP primarily use?
A. Arrays
B. Lists
C. Trees
D. Hash tables
Correct Answer:
B
Chapter: 21
Q386:
How are two-dimensional arrays created in LISP?
A. Using make-array function
B. Using array keyword
C. By defining nested lists
D. By using setf
Correct Answer:
A
Chapter: 21
Q387:
What is the output of (aref chess-board 7 4) after storing 'BLACK-KING' at that position?
A. WHITE-BISHOP
B. BLACK-KING
C. NIL
D. Error
Correct Answer:
B
Chapter: 21
Q388:
Which of the following is a unique feature of LISP?
A. Supports read-time, compile-time, and runtime
B. Allows only static typing
C. Uses arrays as the primary structure
D. No support for garbage collection
Correct Answer:
A
Chapter: 21
Q389:
Fill in the blank: In LISP, symbols act as ________.
A. pointers to strings stored in a hash table
B. static variables
C. temporary variables
D. error handlers
Correct Answer:
A
Chapter: 21
Q390:
What does the get function in LISP retrieve?
A. The value of a variable
B. The value of a property
C. The index of an array
D. The name of a list
Correct Answer:
B
Chapter: 22
Q391:
What does PROLOG stand for?
A. Programming in Logic
B. Program Logic Organizer
C. Predicate Logic Operator Generator
D. Programming Language Operator Guide
Correct Answer:
A
Chapter: 22
Q392:
Who designed PROLOG in 1975?
A. John McCarthy
B. Phillippe Roussell
C. Alan Turing
D. Donald Knuth
Correct Answer:
B
Chapter: 22
Q393:
PROLOG is based on which calculus?
A. Boolean Algebra
B. Predicate Calculus
C. Set Theory
D. Propositional Logic
Correct Answer:
B
Chapter: 22
Q394:
Which of the following is NOT a feature of PROLOG?
A. Declarative syntax
B. Built-in inference mechanism
C. Procedural algorithm specification
D. Symbolic processing
Correct Answer:
C
Chapter: 22
Q395:
In PROLOG, what are facts used for?
A. Defining rules
B. Representing unchanging information
C. Writing algorithms
D. Creating variables
Correct Answer:
B
Chapter: 22
Q396:
Which of the following languages is PROLOG most similar to in its execution model?
A. Python
B. SQL
C. C++
D. JavaScript
Correct Answer:
B
Chapter: 22
Q397:
What type of programming paradigm does PROLOG belong to?
A. Object-Oriented
B. Declarative
C. Procedural
D. Functional
Correct Answer:
B
Chapter: 22
Q398:
PROLOG primarily uses which proof technique?
A. Modus Ponens
B. Modus Tollens
C. Inductive Reasoning
D. Bayesian Inference
Correct Answer:
A
Chapter: 22
Q399:
Which is more efficient for large collections of axioms in PROLOG?
A. Forward chaining
B. Backward chaining
C. Random traversal
D. Brute force search
Correct Answer:
B
Chapter: 22
Q400:
A PROLOG query is used to:
A. Insert new facts
B. Retrieve information
C. Delete rules
D. Optimize algorithms
Correct Answer:
B