Viva Questions For Aiml Lab
Viva Questions For Aiml Lab
CSD 3106
ARTIFICIAL INTELLIGENCE AND MACHINE LEARNING LABORATORY
REVIEW QUESTIONS
2. How can you get input from a user in Python for a username and password?
answer: Using the `input()` function for username and the `getpass()` function for password to
hide input.
4. How would you check if the entered username matches a predefined one in Python?
answer: Using an `if` statement, e.g., `if username == "predefined_username":`.
5. How can you ensure that a password meets certain criteria, like being at least 8 characters
long?
answer: Using a simple `if` statement, e.g., `if len(password) >= 8:`.
3. What data structure is commonly used in BFS to keep track of nodes to visit?
answer: A queue.
EX 4 8 QUEENS PROBLEM
Answer: Data cleaning ensures the dataset is free from errors or missing values, improving the
accuracy of the AI model.
EX 7 FIND S ALGORITHM
1. What is the S-algorithm in AI, and how does it relate to concept learning?
The S-algorithm is used to find the most specific hypothesis that matches positive examples in
concept learning.
3. How can the S-algorithm be implemented in Python for learning concepts from a dataset?
Start with the most specific hypothesis and generalize it based on positive examples from the
dataset.
4. What is the difference between the S-boundary and G-boundary in concept learning, and how
are they used together in the Candidate Elimination Algorithm?
The S-boundary is the most specific hypothesis, and the G-boundary is the most general. They
work together to refine the hypothesis space.
5.Can you demonstrate a simple Python implementation of the Candidate Elimination Algorithm
using the S-algorithm on a sample dataset?**
You write code that updates the S-boundary as you process examples, adjusting it when new
positive examples appear.
EX 8 A* ALGORITHM
3. Explain the role of the `f(n) = g(n) + h(n)` formula in the A* algorithm.
In A*, `f(n)` is the total cost of a node, where `g(n)` is the actual cost from the start to the current
node, and `h(n)` is the heuristic cost from the current node to the goal.
4. How would you implement the A* algorithm in Python to solve a grid-based pathfinding
problem?
You can use a priority queue to store nodes, and for each node, calculate `g(n)`, `h(n)`, and
`f(n)`, updating neighboring nodes as you explore.
2. Explain the role of the S-boundary and G-boundary in the Candidate Elimination Algorithm.
The S-boundary is the most specific hypothesis, and the G-boundary is the most general
hypothesis. Together, they define the hypothesis space.
3. How does the Candidate Elimination Algorithm update the hypothesis space when a new
example is encountered?
For a positive example, S is generalized. For a negative example, G is specialized.
5. How can the Candidate Elimination Algorithm be implemented in Python for concept
learning?
You maintain and update two sets, S and G, based on positive and negative examples during
training.