Prolog Viva Questions
Prolog Viva Questions
i have a viva tommorow from this file provide me 50unique viva question and answer from this file
that can be asked and give explanation of answer
Here are 50 unique viva questions with answers and explanations based on your Artificial
Intelligence Practical File that includes Prolog programs and concepts:
✅ Fundamentals of Prolog
1. Q: What is Prolog?
Explanation: It's declarative, meaning you describe what you want, not how to do it.
2. Q: What are the basic building blocks of a Prolog program?
Explanation: Facts state truths, rules define logic, and queries ask questions.
A: It means "if".
A: `likes(ram, mango).`
Explanation: A statement declaring a relation between two constants.
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 1/6
A: The process of trying alternative paths if one fails.
Explanation: Ensures all possible answers are explored.
9. Q: What is the use of the `!` (cut) operator?
A: `X = music ; X = reading.`
✅ Prolog Input/Output
11. Q: How do you write output in Prolog?
A: Using `write()`.
Explanation: It prints to the console.
A: Using `read()`.
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 2/6
A: Using recursion.
✅ Text Manipulation
26. Q: How do you remove punctuation in a string in Prolog?
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 3/6
A: Filter out non-alphabet characters.
A: It backtracks.
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 4/6
Explanation: Looks for alternative paths.
✅ Output Interpretation
36. Q: Why do we get multiple outputs in some Prolog queries?
A: Due to backtracking.
Explanation: It checks all possible matches.
A: A query to be satisfied.
Explanation: Like a function call.
✅ Advanced Concepts
41. Q: What are knowledge bases in Prolog?
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 5/6
A: A list is a head and a tail list.
Explanation: Foundation for list operations.
✅ Miscellaneous
46. Q: What is a variable in Prolog?
A: To represent negation.
Explanation: Useful in logical constraints.
A: Yes.
Printed using ChatGPT to PDF, powered by PDFCrowd HTML to PDF API. 6/6