Rule base

Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.

Rule base

Name:
Date:
Class:

Quick Questions

Shade in the A or B circle for each question.

1. Which of these is a rule that could be stored in the rule base of an expert system?
A The patient feels hot and tired
B IF temperature > 38 THEN fever
2. What does the rule base of an expert system contain?
A IF-THEN rules that link facts to conclusions
B The screen the user types questions into
3. In the rule IF rain = true THEN take umbrella, which part is the conclusion?
A take umbrella
B rain = true
4. Which rule needs BOTH facts to be true before the conclusion is drawn?
A IF fever AND rash THEN measles
B IF fever OR rash THEN measles
5. The rule is IF fever OR cough THEN see doctor. A patient has a cough but no fever. What is the result?
A No conclusion is drawn
B The conclusion is see doctor

Match the Pairs

Draw a line connecting each item on the left to its match on the right.

Left columnRight column
1IF fever = yes THEN suspect = flu AIF engine = silent THEN fault = battery
2IF rain = yes AND wind = high THEN storm = likely BThe parts are in the wrong order: a rule must start with IF condition and then give THEN conclusion
3A rule links a fact to a conclusion using IF and THEN CA single rule in the rule base: if the condition is true, the system draws the conclusion
4OR lets a rule fire when at least one of its conditions is true DIF cough = yes OR sneeze = yes THEN check = cold
5THEN suspect = flu IF fever = yes EAND makes the rule impossible to meet, because a temperature cannot be above 30 and below 10 at once
6IF temp > 30 AND temp < 10 THEN weather = hot FA rule where both conditions must be true before the conclusion is drawn

Definitions

rule base

Fill in the Blanks

Complete each line of code by filling in the missing parts.

1.
__ fever = TRUE THEN diagnosis = "flu"
2.
IF fever = TRUE ____ diagnosis = "flu"
3.
IF fever = TRUE ___ cough = TRUE THEN diagnosis = "flu"
4.
IF rash = TRUE __ itch = TRUE THEN advice = "see doctor"
5.
IF light = "red" THEN action = "stop" IF _____ = "green" THEN action = "go"

Spot the Error

Shade in the letter of the line that contains an error.

Question 1
A IF fever AND cough flu
B IF rash THEN measles
C IF sneeze THEN cold
Question 2
A IF no_fuel THEN no_start
B IF flat_battery THEN no_start
C IF smoke OR overheat ELSE stop
Question 3
A IF Mon THEN weekday
B IF Tue THEN weekday
C IF Sat AND Sun THEN weekend
Question 4
A IF overdue THEN fine
B THEN block_card IF fine
C IF paid THEN unblock_card
Question 5
A light = red THEN stop
B IF light = green THEN go
C IF light = amber THEN slow

Answer Key

Rule base
Section A: Quick Questions
Q1
B — IF temperature > 38 THEN fever
Q2
A — IF-THEN rules that link facts to conclusions
Q3
A — take umbrella
Q4
A — IF fever AND rash THEN measles
Q5
B — The conclusion is see doctor
Section B: Match the Pairs
Q1
IF fever = yes THEN suspect = flu → A single rule in the rule base: if the condition is true, the system draws the conclusion
Q2
IF rain = yes AND wind = high THEN storm = likely → A rule where both conditions must be true before the conclusion is drawn
Q3
A rule links a fact to a conclusion using IF and THEN → IF engine = silent THEN fault = battery
Q4
OR lets a rule fire when at least one of its conditions is true → IF cough = yes OR sneeze = yes THEN check = cold
Q5
THEN suspect = flu IF fever = yes → The parts are in the wrong order: a rule must start with IF condition and then give THEN conclusion
Q6
IF temp > 30 AND temp < 10 THEN weather = hot → AND makes the rule impossible to meet, because a temperature cannot be above 30 and below 10 at once
Section C: Definitions
Q1
rule base — The part of an expert system holding IF-THEN rules (IF condition THEN conclusion) that link facts to conclusions, often joined with AND/OR, which the inference engine uses to reach answers.
Section D: Fill in the Blanks
Q1
IF fever = TRUE THEN diagnosis = "flu"
Q2
IF fever = TRUE THEN diagnosis = "flu"
Q3
IF fever = TRUE AND cough = TRUE THEN diagnosis = "flu"
Q4
IF rash = TRUE OR itch = TRUE THEN advice = "see doctor"
Q5
IF light = "red" THEN action = "stop" IF light = "green" THEN action = "go"
Section E: Spot the Error
Q1
A — The rule is missing the THEN keyword. A rule must be written IF condition THEN conclusion, so it should be IF fever AND cough THEN flu.
Q2
C — ELSE is used instead of THEN. In a rule base the conclusion follows THEN, so the line should be IF smoke OR overheat THEN stop.
Q3
C — A day cannot be both Saturday and Sunday, so an AND rule would never fire. OR is needed because either fact is enough: IF Sat OR Sun THEN weekend.
Q4
B — The parts of the rule are the wrong way round. The condition comes after IF and the conclusion after THEN, so it should be IF fine THEN block_card.
Q5
A — The rule does not start with IF. Every rule must begin with IF followed by the condition, so it should be IF light = red THEN stop.