Skip to main content

Modern Programming Languages MCQs with Answers

Practice important Modern Programming Languages MCQs with answers and explanations.

Multiple Choice Questions

Q431: In Prolog, the clause brother(X, Y) evaluates as true when:
  • A: X and Y are both brothers
  • B: X is older than Y
  • C: X and Y share the same father
  • D: X and Y are in the same family
View Answer
C

Q432: What type of clause is brother(X, Y):- man(X), man(Y), father(Z, Y), father(Z, X).?
  • A: Fact
  • B: Goal
  • C: Rule
  • D: Predicate
View Answer
C

Q433: How many instances of a goal can exist in a Prolog program?
  • A: None
  • B: One
  • C: Multiple
  • D: Unlimited
View Answer
B

Q434: Which of the following is a valid Prolog goal?
  • A: length([], Len)
  • B: brother(X, Y)
  • C: man(X)
  • D: All of these
View Answer
D

Q435: The truth value of the goal in a Prolog program is considered as:
  • A: A variable
  • B: The program’s output
  • C: A list
  • D: A clause
View Answer
B

Q436: In Prolog, variables are:
  • A: Strongly typed
  • B: Loosely typed
  • C: Immutable
  • D: Both B and C
View Answer
D

Q437: What is the correct syntax for an anonymous variable in Prolog?
  • A: ?
  • B: _
  • C: X
  • D: Variable_1
View Answer
B

Q438: In Prolog, the variable name must:
  • A: Begin with a digit
  • B: Begin with an underscore or capital letter
  • C: Be case-sensitive
  • D: Always be defined at compile time
View Answer
B

Q439: Which of the following is a valid list in Prolog?
  • A: [a, b, c]
  • B: [1, [2, 3]]
  • C: []
  • D: All of these
View Answer
D

Q440: The empty list in Prolog is represented by:
  • A: [0]
  • B: ()
  • C: []
  • D: empty_list
View Answer
C

Test Your Knowledge

Take a timed quiz on Modern Programming Languages

🚀 Start Quiz Now