# Artificial Intelligence Question Bank with Answers : part 2

## Vellore Institute of Technology, Vellore campus

Artificial Intelligence Question Bank with Answers : part 1 link click here

**Q10.Write the steps of Breadth-first search (BFS) algorithm.**

**Q10 Answer: Breadth-first-search Algorithm :**

**Q11.Write the steps of Depth-first search (DFS) algorithm.**

**Q11 Answer: Depth-first-search Algorithm :**

**Q12.Solve the following water jug problem using BFS and DFS algorithms:
You are given two jugs, 4-litre one and 3-litre one. Neither has any measuring marks
on it. There is a pump that can be used to fill the jugs with water. How can we get
exactly 2 litres of water into 4-litre jug?**

**Q12 Answer:**

The state space for this problem can be described as the set of ordered pairs of integers (x,y) such that x=0,1,2,3 or 4 and y=0,1,2 or 3. Here x represents the number of litres of water in the 4-litre jug. and y represents the number of litres of water in the 3-litre jug.

The start state or initial state = (0,0)

The goal state = (2,y)

**Solution using BFS Algorithm:
**

**Solution using DFS Algorithm:**

**Q13.Solve the following water jug problem using BFS and DFS algorithms:
You are given two jugs, 4-litre one and a 3-litre one. Neither has any measuring marks on it. There is a pump that can be used to fill the jugs with water. How can we get exactly 2 litres of water into 3-litre jug?**

**Q13 Answer:**

The state space for this problem can be described as the set of ordered pairs of integers (x,y) such that x=0,1,2,3 or 4 and y=0,1,2 or 3. Here x represents the number of litres of water in the 4-litre jug. and y represents the number of litres of water in the 3-litre jug.

The start state or initial state = (0,0)

The goal state = (x,2)

**Solution using BFS Algorithm:**

**Solution using DFS Algorithm:**

**
Q14.Solve the following water jug problem using BFS and DFS algorithms:
You are given two jugs, 4-gallon one and 3-gallon one. Neither has any measuring marks on it. There is a pump that can be used to fill the jugs with water. How can we get exactly 2 gallons of water into 4-gallon jug?**
**
Q14 Answer:**

The state space for this problem can be described as the set of ordered pairs of integers (x,y) such that x=0,1,2,3 or 4 and y=0,1,2 or 3. Here x represents the number of gallons of water in the 4-gallon jug. and y represents the number of gallons of water in the 3-gallon jug.

The start state or initial state = (0,0)

The goal state = (2,y)

**Solution using BFS Algorithm:**

**Solution using DFS Algorithm:**

**Q15.Solve the following water jug problem using BFS and DFS algorithms:
You are given two jugs, 4-gallon one and 3-gallon one. Neither has any measuring marks on it. There is a pump that can be used to fill the jugs with water. How can we get exactly 2 gallons of water into 3-gallon jug?**

**Q15 Answer:**

The state space for this problem can be described as the set of ordered pairs of integers (x,y) such that x=0,1,2,3 or 4 and y=0,1,2 or 3. Here x represents the number of gallons of water in the 4-gallon jug. and y represents the number of gallons of water in the 3-gallon jug.

The start state or initial state = (0,0)

The goal state = (x,2)

**Solution using BFS Algorithm:**

**Solution using DFS Algorithm:**

**
Q16.Solve the following water jug problem using BFS and DFS algorithms:
You are given two jugs, 6-litre one and a 5-litre one. Neither has any measuring marks on it. There is a pump that can be used to fill the jugs with water. How can we get exactly 2 litres of water into 6-litre jug?**

**Q16 Answer:**

The state space for this problem can be described as the set of ordered pairs of integers (x,y) such that x=0,1,2,3,4,5 or 6 and y=0,1,2,3,4 or 5. Here x represents the number of litres of water in the 6-litre jug. and y represents the number of litres of water in the 5-litre jug.

The start state or initial state = (0,0)

The goal state = (2,y)

**Solution using BFS Algorithm:**

**Solution using DFS Algorithm:**

**Q17.Solve the following Water jug problem using BFS and DFS algorithm:
you are given two jugs, 6-litre one and 5-litre one, Neither has any measuring marks on it. There is a pump that can be used to fill the jugs with water.
How exactly can you get 2 litres of water into a 5-litre jug?**

**Q17 Answer :**

The state space for this problem can be described as set of ordered pairs of integers (x,y) such that x=0,1,2,3,4,5,6 and y=0,1,2,3,4 or 5 Here, x represents the amount of water in the 6-litre jug and y represents the amount of water in the 5-litre jug.

The Start state or Initial state=(0,0)

The Goal state=(x,2)

**Solution using BFS Algorithm:**

**Solution using DFS Algorithm:**

**Q18.Solve the following Water jug problem using BFS and DFS algorithm:
you are given two jugs, 6-gallon one and 5-gallon one, Neither has any measuring marks on it. There is a pump that can be used to fill the jugs with water. How exactly can you get 2 gallons of water into a 6-gallon jug?**

**Q18 Answer :**

The state space for this problem can be described as set of ordered pairs of integers (x,y) such that x=0,1,2,3,4,5,6 and y=0,1,2,3,4 or 5. Here, x represents the amount of water in the 6-gallon jug and y represents the amount of water in the 5-gallon jug.

The Start state or Initial state=(0,0)

The Goal state=(2,y)

**Solution using BFS Algorithm:**

**Solution using DFS Algorithm:**

**
Q19.Solve the following Water jug problem using BFS and DFS algorithm:
you are given two jugs, 6-gallon one and 5-gallon one, Neither has any measuring marks on it. There is a pump that can be used to fill the jugs with water.
How exactly can you get 2 gallons of water into a 5-gallon jug?**

**Q19 Answer :**

The state space for this problem can be described as set of ordered pairs of integers (x,y) such that x=0,1,2,3,4,5 or 6 and y=0,1,2,3,4 or 5. Here, x represents the amount of water in the 6-gallon jug and y represents the amount of water in the 5-gallon jug.

The Start state or Initial state=(0,0)

The Goal state=(x,2)

**Solution using BFS Algorithm:**

**Solution using DFS Algorithm:**

Artificial Intelligence Question Bank with Answers: part 3 click here

### Did you find this article valuable?

Support **naveenkumar j** by becoming a sponsor. Any amount is appreciated!