Online Examination
Question & Answers
QNo. Question Answer
1 What is a fact in Prolog? A statement that is always true
2 Which of the following represents a valid fact in Prolog? likes(john, pizza).
3 What is a rule in Prolog? A statement that derives new facts
4 Which operator is used to define rules in Prolog? :-
5 What is a predicate in Prolog? A condition that evaluates to true or false
6 Which of the following is a valid Prolog predicate? parent(X, Y).
7 What is backtracking in Prolog? Going back and trying alternative solutions
8 Which Prolog mechanism helps in solving multiple queries? Backtracking
9 How do you make a query in Prolog? By typing a goal followed by a period
10 What is the output if a query fails in Prolog? false
11 What is recursion in Prolog? A function calling itself
12 Which type of recursion is commonly used in Prolog? Tail recursion
13 What is the goal in the Monkey-Banana problem? The monkey must reach the banana
What Prolog technique is used to solve the Monkey-Banana
14 Recursion
problem?
15 What is the main challenge in the Water Jug Problem? Measuring a specific amount of water
Which Prolog technique is commonly used to solve the Water Jug
16 State-space search
Problem?
17 Which of the following is a valid Prolog variable? X
18 Which built-in Prolog function is used to check equality? ==
19 What does the cut operator (!) do in Prolog? Prevents backtracking
20 Which keyword is used for defining a rule in Prolog? :-
21 Which data structure is commonly used in Prolog? List
22 What does the underscore (_) represent in Prolog? Anonymous variable
23 How does Prolog evaluate expressions? By pattern matching
24 Which of the following is a valid Prolog list? [1,2,3]
25 How does Prolog search for solutions? Depth-first search
26 What is the purpose of unification in Prolog? To match terms
27 Which Prolog operator is used for arithmetic evaluation? is
28 What does the fail predicate do in Prolog? Forces backtracking
29 Which file extension is used for Prolog programs? .pl
30 What is the base case in Prolog recursion? The stopping condition
31 Which of the following is a characteristic of Prolog? Declarative programming
Print