Modern Programming Languages MCQs with Answers
Practice important Modern Programming Languages MCQs with answers and explanations.
Multiple Choice Questions
Q421: Fill in the blank: In Prolog, the names of all relationships and objects must begin with a __________.
- A: lowercase letter
- B: digit
- C: uppercase letter
- D: special character
View Answer
A
Q422: Fill in the blank: The Prolog statement rainy(columbo). represents a __________.
- A: rule
- B: query
- C: fact
- D: comment
View Answer
C
Q423: Fill in the blank: Propositional Logic statements involve connectives such as __________.
- A: +, -, *
- B: ¬, ∧, ∨, ⇒
- C: <, >, =
- D: @, &, $
View Answer
B
Q424: What is the result of the Prolog query ?- snowy(ayubia). given the facts and rules?
- A: yes
- B: no
- C: error
- D: undefined
View Answer
A
Q425: What is the output of the Prolog query ?- snowy(columbo).?
- A: yes
- B: no
- C: error
- D: C = columbo
View Answer
B
Q426: Which of the following is a valid Prolog query?
- A: &rainy
- B: isa(dog, X)
- C: %comment
- D: 123variable
View Answer
B
Q427: Fill in the blank: In Prolog, the rule snowy(X) :- rainy(X), cold(X). defines snowy(X) as true if both __________.
- A: rainy(X) and cold(X) are true
- B: rainy(X) or cold(X) is true
- C: cold(X) is false
- D: none of the above
View Answer
A
Q428: What is the role of a predicate in Prolog?
- A: A declaration of rules or relations
- B: The main goal of a program
- C: A variable placeholder
- D: An anonymous variable
View Answer
A
Q429: Which is an example of a predicate in Prolog?
- A: brother(ahmed, chand)
- B: father(X, Y)
- C: man(symbol)
- D: write(arg)
View Answer
C
Q430: A Prolog fact contains:
- A: Parameters as variables
- B: Parameters as constants
- C: No parameters
- D: Both constants and variables
View Answer
B