حل اسئلة انظمة ذكية قسم الحاسوب الجامعة المستنصرية نموذج رقم 1
Q1: Choose the correct answer. Note that a multiple-choice question can have more than one correctanswer. (16 marks)
1- The set of approaches proposed to model and find solutions to those real-world problems that
are not modeled or too difficult to model mathematically, is called:
(A) Artificial Immune System (B) Soft Computing (C) Expert Systems
(D) Natural Language Processing (E) None of the above
2- All of the following are shortcomings of an expert system, except:
(A) Separation of knowledge from its processing (B) Opaque relations between rules
(C) Ineffective search strategy (D) Inability to learn (E) All of the above
3- In the backward chaining version of the animal classification system, the subordinate rule that
divides the animals into classes is:
(A) confirm (B) it_is (C) remember (D) identify (E) guess_animal
4- Which of the following is false about Expert System?
(A) Able to show its knowledge in a form that is easy to read and understand
(B) Unable to integrate new knowledge (C) Explain how it reaches a particular conclusion
(D) Act as an intelligent assistant in some specific domain of expertise (E) None of the above
5- All of the following are components of an expert system, except:
(A) Database (B) Knowledge base (C) Knowledge acquisition
(D) Interface engine (E) User interface
6- Natural Language Processing includes anything a computer needs to:
(A) Understand natural language (B) Produce and percept speech
(C) Identify sound patterns of language (D) Generate natural language
(E) Classify acoustic signals into phones
7- Which of the following intelligent systems is often used to understand handwriting in
applications like PDAs?
(A) Fuzzy Logic (B) Artificial Immune System (C) Neural Networks
(D) Genetic Algorithms (E) Natural Language Understanding
8- Who formulates the domain expertise into an expert system?
(A) Domain expert (B) Knowledge engineer (C) Programmer (D) User
(E) Project manager
Q2: Consider the following pattern recognition system:
(7 marks)
User Machine
... friend ... what about your friends?
... lie or cry ... please do not use words like that.
... I am happy ... what things make you happy?
Write makeans and recognize predicates that correspond to the above system. Make sure to return to the third question or write "Tell me more" when no matching is found.
Sol//
Q3: Design a minimized CFG grammar then write a Visual Prolog program that describes commands related to moving a car. The grammar should accept queries of these forms:
(7 marks)
1- "move", followed by a direction (up, down, right, or left), optionally followed by an adverb
describing speed (quickly, rapidly, or slowly).
2- "enter", followed by the, followed by a noun (park or garage).
3- "exit", followed by the, followed by a noun (park or garage).
Sol//
Command -> Move | Enter | Exit Move -> "move" Direction Adverb? Direction -> "up" | "down" | "right" | "left" Adverb -> "quickly" | "rapidly" | "slowly" Enter -> "enter" "the" Noun Exit -> "exit" "the" Noun Noun -> "park" | "garage"
Q4: (7 marks)
Consider the following knowledge base. Assume that the conflict resolution strategy is to pick the
rule with the most preconditions that matches Working Memory (WM) and has not already been
used. Break ties by choosing the lowest numbered rule.
(1) A ^ ¬B → ADD(D)
(2) C ^ A ^ ¬D → DELETE(A)^ ADD(B)
(3) D → PRINT("Brilliant!")
(4) B → PRINT("Brilliant!")
(5) C ^ B → DELETE(C)^ DELETE(B) ^ ADD(A)
(6) ¬C ^ ¬A ^ ¬D ^ ¬B → PRINT("Oops!")
Assume that the system terminates when either no unused rules match Working Memory (WM) or the system executes a PRINT action. Illustrate the operation of this production system; assume that the initial contents of WM are: C, A, ¬D, ¬B.
Note: ADD’ing X means that ¬X is removed from WM and X is inserted, while DELETE’ing X
means that X is removed from WM and ¬X is inserted.
Sol//
1. Initial Working Memory (WM): C, A, ¬D, ¬B
2. Matching Rules:
- Rule (2) matches: C ^ A ^ ¬D, has 3 preconditions
- Rule (5) matches: C ^ B, has 2 preconditions
3. Conflict Resolution:
- Rule (2) has more preconditions than Rule (5), so it is chosen.
4. Action:
- DELETE(A)^ ADD(B) is executed, modifying WM to: C, ¬A, ¬D, B
5. Matching Rules with New WM:
- Rule (1) matches: A ^ ¬B, has 2 preconditions
- Rule (3) matches: D, has 1 precondition
- Rule (4) matches: B, has 1 precondition
6. Conflict Resolution:
- Rule (1) and Rule (3) have the same number of preconditions. Rule (1) is lower numbered, so it is chosen.
7. Action:
- ADD(D) is executed, modifying WM to: C, ¬A, ¬D
8. Matching Rules with New WM:
- Rule (6) matches: ¬C ^ ¬A ^ ¬D ^ ¬B, has 4 preconditions
9. Action:
- PRINT("Oops!") is executed.
10. Termination: The system executes a PRINT action, so the operation terminates.
العملي Lab
Note: Answer ONE question (12 marks)
Q1: Consider the following sentences:
1- Ali will buy a new car tomorrow.
2- Some persons can own respecting by a nice job.
Build a context free grammar for the above sentences, and then write a complete Visual Prolog program that parses them.
Sol//
S -> NP VP | Aux NP VP NP -> Pronoun | ProperNoun | Det Noun | NP PP VP -> Verb | VP NP | VP Adverb | VP PP | VP Aux VP PP -> Preposition NP Det -> "a" | "the" | "some" Noun -> "car" | "persons" | "job" ProperNoun -> "Ali" Pronoun -> "Some" Verb -> "will" | "buy" | "own" | "respecting" Aux -> "can" Adverb -> "tomorrow" | "nicely" Preposition -> "by"
Q2: Do as required
a- Write a Visual Prolog program that finds the index of an element in a list L:
L= [a,b,c,d,e,f,g] index of c=3
b- Consider the following Visual Prolog program segment:
result(_, []).
result([_, E | L], [E | M]) :- result(L, M).
After having consulted this program, what would Prolog reply when presented with the following
query?
Sol//
a) Here's a Visual Prolog program that finds the index of an element in a list:
domains element = char list = element* predicates index_of(element, list, integer) clauses index_of(Element, List, Index) :- index_of(Element, List, 1, Index). index_of(_, [], _, -1). index_of(Element, [Element|_], Index, Index). index_of(Element, [_|Tail], CurrentIndex, Index) :- NextIndex = CurrentIndex + 1, index_of(Element, Tail, NextIndex, Index).
You can use the `index_of/3` predicate to find the index of an element in a list. For example:
index_of('c', [a,b,c,d,e,f,g], Index).
This will return `Index = 3`.
b) The Prolog program segment you provided defines a predicate `result/2` which succeeds when the second argument is a sublist of the first argument, with elements interspersed with other elements. For example:
result([a,b,c,d,e,f,g], [b,c,e]).
Prolog would reply `true` for this query.