MCQ Bank
Following is a fact, write the respective PROLOG clause: "aspirin relieves headache."
- A) aspirin (relieves, headache).
- B) relieves (aspirin, headache).
- C) headache (aspirin, relieves).
- D) relieves (pain, headache).
"dotime" loop of LISP is similar in working to _______of Ada.
- A) if-else statement
- B) switch statement
- C) for loop
- D) while loop
In a PROLOG program, the names of all relationships and objects must begin with:
- A) Uppercase letter
- B) Dollar sign ($)
- C) Lowercase letter
- D) Underscore
The facts in a PROLOG program must end with:
- A) Full stop (.)
- B) Comma (,)
- C) Colon (:)
- D) Semicolon (;)
The correct syntax of ‘setf’ function in LISP is:
- A) (setf (get object attribute) value)
- B) (setf (object value) attribute)
- C) (setf (symbol attribute value) object)
- D) (setf (object attribute) value)
Identify the purpose of following statement in LISP:
(setf students (make-array ‘(8 8)))
- A) It creates a linear array of eight elements
- B) It converts the variable ‘students’ into an array of size 8
- C) It creates an array of size 8 and assigns it to variable ‘students’
- D) It creates a two-dimensional array of 64 elements
Consider the following PROLOG statement: brother(ahmed, _ ) In the above statement, underscore ( _ ) is known as:
- A) Concatenation Operator
- B) Hidden Constant
- C) Variable separator
- D) Anonymous variable
Prolog has very powerful ____________mechanism.
- A) Object oriented
- B) Pointer arithmetic
- C) Inference
- D) String manipulation
To sort a list in PROLOG language, we need to:
- A) Use the Forward Chaining mechanism
- B) Tell the inference engine of PROLOG that what sorting means
- C) Use Dynamic Programming Techniques
- D) Write the sorting algorithm
The correct way to write comments in a PROLOG program is:
- A) /* This is also a comment */
- B) # Consider this a comment
- C) % This is another comment
- D) // This is a comment
In a PROLOG program, the definitions of predicate sentences or phrases are known as:
- A) Inferences
- B) Declarations
- C) Clauses
- D) Facts
Array elements can be accessed by using _______ function in LISP.
- A) access
- B) linear-array
- C) aref
- D) getf
All the variables in PROLOG clauses/predicates are:
- A) Generic
- B) Global
- C) Strongly typed
- D) Local
Which of the following statement in LISP is used to list all properties of symbol ‘k’?
- A) >(get all ‘k)
- B) >(symbol-plist ‘k)
- C) >(get ‘k)
- D) >(obtain all ‘k)
Array indexes in LISP can be:
- A) Characters
- B) any discrete type
- C) Floating point numbers
- D) Integers
While eliminating repeated elements of list in PROLOG, each element should be replaced with:
- A) Previous element
- B) Single copy of the same element
- C) Next element
- D) Blank space
PROLOG supports the __________ programming paradigm.
- A) Declarative
- B) Aspect Oriented
- C) Object Oriented
- D) Functional
_________ operator in Prolog is used for List construction and also for List dismantling.
- A) | (Vertical Bar)
- B) : (Colon)
- C) . (Full Stop)
- D) ! (Sign of Exclamation)
Basic elements of a program in PROLOG are:
- A) Entities and objects
- B) Predicates and rules
- C) Facts and figures
- D) Rules and queries
Following statement in PROLOG is considered as ______________________. "relieves(penicilline, pneumonia)"
- A) Rule
- B) Fact
- C) Variable
- D) Constant