Docsity

Midterm Exam Questions - Artificial Intelligence Programming | CS 662, Exams of Computer Science

Toggle sidebar
bg1
Name:
CS 662 Sample Midterm
1 True/False, plus corrections
35 pts, 5 pts each
Each of the following statements is either true or false. If it is true, mark it true. If it is false, correct
the statement so that it is true. Note: Adding “not” or otherwise negating the sentence is not acceptable.
You must change the facts in the sentence if it is false. For example:
Question: The Turing Test is a test of whether a computer program is rational.
Bad answer, no credit: The Turing Test is not a test of whether a computer program is rational.
Good answer: The Turing Test is a test of whether a computer program is indistinguishable from a
human.
•A stochastic environment is one in which an action may have more than one result.
True.
•A chart parser is more efficient than a top-down parser because it never backtracks.
False. A Chart parser is more efficient because it caches partial solutions in a chart,
thereby avoiding re-expending portions of the search tree.
•A rational agent is an agent that does what a human would do in any situation.
False. A rational agent selects actions that maximize expected p erformance measure.
•A toy problem is a problem used to illustrate or study the performance of an algorithm.
True.
•A complete algorithm is one that always finds all possible solutions to a problem.
False. A complete algorithm is guaranteed to find a solution if one exists.
•A corpus is something that a vampire eats.
False. A corpus is a collection of documents used to create a language model.
•A Goal-based agent selects actions that are likely to maximize its utility. False. A goal-based agent
selects actions that will achieve its goal.
2 Agents and environments
a. 24 pts, 6 pts each
For each of the following agents and environments, characterize the environment according to the six
properties used in R & N (static vs dynamic, discrete vs. continuous, fully vs. partially observable, deter-
ministic vs stochastic, episo dic vs. sequential, single-agent vs. multi-agent). If necessary, you may want to
give a brief justification of your answers.
•The game of checkers. Static, discrete, fully observable, deterministic, sequential, multi-
agent.
pf3
pf4
pf5

Partial preview of the text

Download Midterm Exam Questions - Artificial Intelligence Programming | CS 662 and more Exams Computer Science in PDF only on Docsity!

Name:

CS 662 Sample Midterm

1 True/False, plus corrections

35 pts, 5 pts each

Each of the following statements is either true or false. If it is true, mark it true. If it is false, correct the statement so that it is true. Note: Adding “not” or otherwise negating the sentence is not acceptable. You must change the facts in the sentence if it is false. For example: Question: The Turing Test is a test of whether a computer program is rational. Bad answer, no credit: The Turing Test is not a test of whether a computer program is rational. Good answer: The Turing Test is a test of whether a computer program is indistinguishable from a human.

  • A stochastic environment is one in which an action may have more than one result.

True.

  • A chart parser is more efficient than a top-down parser because it never backtracks.

False. A Chart parser is more efficient because it caches partial solutions in a chart, thereby avoiding re-expending portions of the search tree.

  • A rational agent is an agent that does what a human would do in any situation.

False. A rational agent selects actions that maximize expected performance measure.

  • A toy problem is a problem used to illustrate or study the performance of an algorithm.

True.

  • A complete algorithm is one that always finds all possible solutions to a problem.

False. A complete algorithm is guaranteed to find a solution if one exists.

  • A corpus is something that a vampire eats.

False. A corpus is a collection of documents used to create a language model.

  • A Goal-based agent selects actions that are likely to maximize its utility. False. A goal-based agent selects actions that will achieve its goal.

2 Agents and environments

a. 24 pts, 6 pts each

For each of the following agents and environments, characterize the environment according to the six properties used in R & N (static vs dynamic, discrete vs. continuous, fully vs. partially observable, deter- ministic vs stochastic, episodic vs. sequential, single-agent vs. multi-agent). If necessary, you may want to give a brief justification of your answers.

  • The game of checkers. Static, discrete, fully observable, deterministic, sequential, multi- agent.
  • An autopilot that successfully lands a plane. Dynamic, continuous, partially observable, stochas- tic, sequential, single-agent
  • An handwriting recognition agent that reads the addresses on envelopes and places each of them in the appropriate mailbox. Static, discrete, fully observable, deterministic, episodic, single-agent
  • A music-playing accompanist agent that can play along with a human piano player. Dynamic, con- tinuous, partially observable, deterministic, sequential, multi-agent

b. 6 pts

Consider the following problem: We want to build an agent that can play word games. For our first task, we would like to build an agent that can recognize palindromes. (A palindrome is a word or phrase that reads the same backwards as forwards excpeting punctuation, such as “Anna” or “Madam, I’m Adam”, or “A man, a plan, a canal - Panama!”)

Assume that our agent receives its input one letter at a time. That is, at time t=0 it sees ’a’, and and time t=1 it sees ’n’, and so on. Once the string is seen completely, the agent must output ’yes’ or ’no’.

Can a reflex agent solve this problem? If so, provide pseudocode for how such an agent might work. (You may use the back of the page if needed.) If not, explain precisely why it cannot solve this problem. No -

a reflex agent has no memory. Recognizing a palindrome requires memorizing past characters to ensure that a particular pattern has been seen.

For our second task, we want to build an agent that can find anagrams. That is, rearrangements of a phrase that are also a phrase. For example, “scab” can be rearranged to “cabs”, and “artificial intelligence” can be rearranged to make (among other things): “Intergalactic lie? Fie! Nil!” (punctuation added).

Let’s assume that we want to build a goal-based agent that will use search to find an anagram for an arbirtary input phrase. Your task in this problem will be to formulate the problem precisely enough so that it can be implemented. In grading this, I’ll ask two questions. 1) Is the answer correct? 2) Could I write a program from this answer without any additional information?

a) 4 pts Give an initial state for this search.

An input string, and an empty output string.

b) 4 pts Give a description of how a goal test could be implemented. Split the phrase on space and

look up each word in a dictionary. If all letters are used and all words are in the dictionary, the goal is reached.

c) 4 pts Describe what the successor function does. In other words, for a given input, what is produced?

For a given index i, return n-i new strings with the letters at positions i and n-i exchanged.

3 Search

a) (4 pts each) Give the time and space requirements in big-O terms for each of the following algorithms.

Assume that the search tree has a branching factor of b, the solution is at depth d, and the tree has a maximum depth of n.

  • Breadth-first search Time: O(bd+1), Space: O(bd+1)
  • Depth-first search Time: O(bn), Space: O(bn)
  • Depth-limited search (depth = d) Time: O(bd), Space: O(bd)
  • Iterative deepening search Time: O(bd), Space: O(bd)

4 Heuristics

a. 4 pts

Consider the Tower of Hanoi problem. There are three towers, with N disks of increasing size stacked on the leftmost tower. The problem is to move the disks from the left-hand to the right-hand tower, with the constraint that a larger disk can never be placed on top of a smaller disk.

To begin, let h be the number of disks that still need to be moved. Is this heuristic admissible? If so, prove it. If not, provide a counterexample. Yes. Moving h disks requires 2 h^ − 1 moves. This is larger

than h for all h ¿=0. b. 6 pts

Next, consider the following heuristic: Number the disks according to size, where 1 is the smallest disk and n is the number of the largest disk. h is the sum of the numbers of each misplaced disk.

Which heuristic should be used? Justify your answer with a precise technical argument, using the appropriate terminology. h2 dominates h1, so it should be used. (I’ll leave the proof as an

exercise.) 5 pts c. Use an admissibility argument to show that uniform cost search is optimal. We

know that A* is optimal if it uses an admissible heuristic, which is a heuristic that always underestimates the distance to the goal. Uniform-cost search uses only path cost, and so the heuristic is always 0, which is less than or equal to the true cost.

5 Information Retrieval

Consider a corpus of 10 documents that consists entirely of the following words and document frequencies:

cat: 8 dig : 5 fish : 3 snail : 1 puppy: 10 artichoke: 2 kangaroo: 3

Suppose we have the following documents: d1: cat snail cat cat puppy kangaroo d2: fish fish cat kangaroo puppy snail a) For each word in d1 and d2, indicate their TFIDF scores. : d1: cat: 3 * log(10/8) = 0.96, snail: 1 * log(10/1) = 3.32, puppy: 1 * log(10/10) = 0, kangaroo: 1 * log(10/3) = 1. d2: fish: 2 * log(10/3) = 3.47, cat: 1 * log(10/8) = 0.32, kangaroo: 1 * log(10/3) = 1.74, puppy: 1 * log(10/10) = 0, snail: 1 * log(10/1) = 3.

b) What is the cosine similarity between d1 and d2? numerator: 0.96 * 0.32 + 3.32 * 3.32 + 1.74 * 1.74 = 14. Denominator: 3.87 * 5.18 = 20. sim: 0.