CAIRO UNIVERSITY
Faculty of Computers and Information
Course: CS361 Artificial Intelligence Midterm Exam Date: 18th March, 2018
Instructor: Dr. Khaled Wassif Allowed Time: 60 minutes
CS 1
Name: _____________________ ID: _______ Group: IS 2
IT 3
4
5
6
Attempt ALL Questions: 7
Q1) Select an appropriate choice for each of the following sentences:
(5 Marks)
1. What is Artificial intelligence?
a) Putting your intelligence into Computer
b) Programming with your own intelligence
c) Making a Machine intelligent
d) Playing a Game
2. Which instruments are used for perceiving and acting upon the environment?
a) Sensors and Actuators b) Sensors
c) Perceiver d) None of the mentioned
3. What is the composition for agents in artificial intelligence?
a) Program b) Architecture
c) Both a & b d) None of the mentioned
4. What is rational at any given time depends on
a) The performance measure that defines the criterion of success
b) The agent’s prior knowledge of the environment
c) The actions that the agent can perform
d) All of the mentioned
5. What kind of environment is crossword puzzle?
a) Static b) Dynamic
c) Semidynamic d) None of the mentioned
6. Which is used to provide the feedback to the learning element?
a) Critic b) Actuators
c) Sensor d) None of the mentioned
Page 1 of 4
7. The major component(s) for measuring the performance of problem solving
a) Completeness b) Optimality
c) Time and Space complexity d) All of the mentioned
8. Which search method takes less memory?
a) Depth-First Search b) Breadth-First search
c) Both (a) and (b) d) Optimal search
9. What is the space complexity of Depth-first search?
a) O(b) b) O(bl) c) O(m) d) O(bm)
10. Which search implements stack operation for searching the states?
a) Depth-limited search b) Depth-first search
c) Breadth-first search d) None of the mentioned
Q2) Describe the Utility-based Agents (using a figure or an algorithm).
(4 Marks)
function UTILITY-BASED-AGENT (percept) returns action
static: state, a description of the current world state
rules, a set of condition-action rules
action, the most recent action, initially none
utility, the function that measures its performances
state UPDATE-STATE(state, action, percept, model)
rules RULE-MATCH(state, rules)
actions RULE-ACTION[rules]
action CHOOSE-ACTION(utility, actions)
return action
Page 2 of 4
Q3) Consider a state space where the start is number 1 and the
successor function for a state n returns two states, numbers 2n
and 2n + 1. (8 Marks)
a. Draw the portion of the state space for states 1 to 20.
b. Suppose the goal states are 13 and 18. List the order in
which nodes will be visited and the solution for breadth-first
search, uniform cost search (assume the cost of all actions
is 2), depth-first search, depth-limited search with limit 3,
and iterative deepening search.
Breadth-first search
Expanded: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13
Solution Path: 1, 3, 6, 13
Uniform cost search
Expanded: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13
Solution Path: 1, 3, 6, 13
Depth-first search
Expanded: 1, 2, 4, 8, 16, 17, 9, 18
Solution Path: 1, 2, 4, 9, 18
Depth-limited search with limit 3
Expanded: 1, 2, 4, 8, 9, 5, 10, 11, 3, 6, 12, 13
Solution Path: 1, 3, 6, 13
Iterative deepening search
Level 0 Expanded: 1 Fail
Level 1 Expanded: 1, 2, 3 Fail
Level 2 Expanded: 1, 2, 4, 5, 3, 6, 7 Fail
Level 3 Expanded: 1, 2, 4, 8, 9, 5, 10, 11, 3, 6, 12, 13
Solution Path: 1, 3, 6, 13
Page 3 of 4
Q4) By Prolog, define a reverse predicate that takes 2 lists the first
list is an input list and the second is a reversed list. (3 Marks)
append([],L,L).
append([H|T],L2,[H|L3]) :- append(T,L2,L3).
reverse([],[]).
reverse([H|T],RL) :- reverse(T,RT), append(RT,[H],RL).
With My Best Wishes
Page 4 of 4