Modern Programming Languages MCQs with Answers
Practice important Modern Programming Languages MCQs with answers and explanations.
Chapter: 22
Q401:
Which is an example of a fact in PROLOG?
A. animal(X) :- isa(X, mammal).
B. ?- animal(dog).
C. isa(dog, mammal).
D. H :- B1, B2.
Correct Answer:
C
Chapter: 22
Q402:
The term "isa(dog, mammal)." in PROLOG defines:
A. A query
B. A fact
C. A rule
D. A function
Correct Answer:
B
Chapter: 22
Q403:
PROLOG applications include all of the following EXCEPT:
A. Expert systems
B. Logical puzzles
C. Compiling C++ code
D. Artificial intelligence
Correct Answer:
C
Chapter: 22
Q404:
What does ":-" signify in a PROLOG rule?
A. Equality
B. Dependency
C. Deduction
D. Conjunction
Correct Answer:
C
Chapter: 22
Q405:
The query "?- isa(dog, X)." will return:
A. X = bird
B. X = mammal
C. X = reptile
D. No answer
Correct Answer:
B
Chapter: 22
Q406:
PROLOG primarily deduces information by:
A. Syntax parsing
B. Applying axioms
C. Rule evaluation
D. String matching
Correct Answer:
C
Chapter: 22
Q407:
Which of the following is NOT a use of PROLOG?
A. Natural language understanding
B. Web development
C. Logical games
D. Expert systems
Correct Answer:
B
Chapter: 22
Q408:
What kind of clauses does logic programming in PROLOG use?
A. Horn clauses
B. Boolean clauses
C. Predicate clauses
D. Recursive clauses
Correct Answer:
A
Chapter: 22
Q409:
In the rule "C :- A, B," what does it mean if both A and B are true?
A. C is false
B. C is true
C. A is false
D. B is irrelevant
Correct Answer:
B
Chapter: 22
Q410:
Which query would return "yes" in PROLOG?
A. ?- animal(table).
B. ?- isa(cat, fish).
C. ?- animal(sparrow).
D. ?- isa(bird, sparrow).
Correct Answer:
C
Chapter: 23
Q411:
In Prolog, which type of constant begins with a lowercase letter?
A. Numbers
B. Atoms
C. Variables
D. Compound Terms
Correct Answer:
B
Chapter: 23
Q412:
Which of the following is an example of a quoted atom in Prolog?
A. apple
B. ‘hello world’
C. &
D. studies
Correct Answer:
B
Chapter: 23
Q413:
In Prolog, variables must begin with what type of character?
A. Lowercase letter
B. Uppercase letter
C. Digit
D. Special character
Correct Answer:
B
Chapter: 23
Q414:
What symbol is used to indicate comments in Prolog?
A. //
B. #
C. %
D. ;
Correct Answer:
C
Chapter: 23
Q415:
In Prolog, the relationship and objects in facts must be separated by:
A. Periods
B. Commas
C. Semicolons
D. Colons
Correct Answer:
B
Chapter: 23
Q416:
The Prolog rule snowy(X) :- rainy(X), cold(X). means:
A. Snowy is true if rainy is false
B. Snowy is true if both rainy and cold are true
C. Snowy is true if either rainy or cold is true
D. Snowy is always true
Correct Answer:
B
Chapter: 23
Q417:
What does Propositional Logic primarily deal with?
A. Numbers
B. Boolean statements
C. String manipulation
D. Database queries
Correct Answer:
B
Chapter: 23
Q418:
What is the meaning of the statement ¬p in propositional logic?
A. p is true
B. p and q are true
C. Ahmed is not father of Belal
D. Ahmed is father of Belal
Correct Answer:
C
Chapter: 23
Q419:
In Prolog, the statement studies(ali, programming). represents:
A. A rule
B. A fact
C. A query
D. A comment
Correct Answer:
B
Chapter: 23
Q420:
The statement p ∧ q ⇒ r in propositional logic means:
A. Ahmed is not father of Belal
B. Ahmed is father of Belal or brother of Aslam
C. If Ahmed is father of Belal and brother of Aslam, then Aslam is uncle of Belal
D. None of the above
Correct Answer:
C