Questions: 35

Free Answers by our Experts: 23

Ask Your question

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Prolog Questions

1: write prolog program to search book by book_title ,by book_author, by book_edition Using

recursion.

Hint: your input must be from above mentions, your rule must recursively find the book and

display the complete book information as provided in facts.

Facts: book(b_name,b_authmb_edition)

search_book() :-

write(\"Enter book author name : \"),

readln(BOOK_AUTH),

data(name(Z),company(BOOK_AUTH)),

nl, write(Z),

fail.


1 Translate the following sentences into a Prolog program (10)
Everyone who teaches programming module is smart.
Craig teaches the programming module.
Craig’s brother teaches the mathematics module.
The programing module is interesting.
Craig’s sister teaches all modules.
1. Write a predicate (first_middle_last/4) to find the first, middle, and last elements of a list. Some built-in predicates that may help you: nth0/3 (this is written as nth/3 in the above link, but it should actually be nth0/3), length/2, div/2 (performs integer division). You may use any built-in predicates you like. There is a section on List Processing that you might find helpful. After implementing your predicate, please run the following tests and include the answers in your pdf submission (screenshots might work best).
a. first_middle_last ([1,2,3], First, Middle, Last).
b. first_middle_last ([1,2,3,4,5], First, Middle, Last).
c. first_middle_last ([19,25,72,9,4,15,23,19,32,41,53], First, Middle, Last).
A University of Zululand student graduates with a Bachelor of Science degree in Agriculture (Agronomy) by passing 20 modules in total. The marks obtained for each module (in percentage form) are given below:

71 52 81 66 77 96 83 77 65 59
82 97 72 91 50 63 53 74 77 88


1.1 Group the data into a frequency distribution with the lowest class lower limit of 50 percent and a class width of 10 percent.
Prolog Questions
1: write prolog program to search book by book_title ,by book_author, by book_edition Using
recursion.
Hint: your input must be from above mentions, your rule must recursively find the book and
display the complete book information as provided in facts.
Facts: book(b_name,b_authmb_edition)
search_book() :-
write(\"Enter book author name : \"),
readln(BOOK_AUTH),
data(name(Z),company(BOOK_AUTH)),
nl, write(Z),
fail.
Prolog Questions
1: write prolog program to search book by book_title ,by book_author, by book_edition Using
recursion.
Hint: your input must be from above mentions, your rule must recursively find the book and
display the complete book information as provided in facts.
Facts: book(b_name,b_authmb_edition)
search_book() :-
write(\"Enter book author name : \"),
readln(BOOK_AUTH),
data(name(Z),company(BOOK_AUTH)),
nl, write(Z),
fail.
Prolog Questions
1: write prolog program to search book by book_title ,by book_author, by book_edition Using
recursion.
Hint: your input must be from above mentions, your rule must recursively find the book and
display the complete book information as provided in facts.
Facts: book(b_name,b_authmb_edition)
search_book() :-
write(\"Enter book author name : \"),
readln(BOOK_AUTH),
data(name(Z),company(BOOK_AUTH)),
nl, write(Z),
fail.
http://pages.cpsc.ucalgary.ca/~robin/class/449/assignments/sol_2019.pdf
Consider the problem taken from life insurance expert (RULE 1 if age is old and gender is male and smoker is no then risk is low; RULE 2 if age is middle and gender is male and smoker is yes then risk is high; RULE 3 if age is young and gender is female and smoker is no then risk is low;). Write a complete PROLOG program that could support the decision of a life insurance expert. Add necessary facts and rules to produce a well designed knowledge base.
Write a Prolog program that can answer
<S> → <A> a <B> b
<A> → <A> b | b
<B> → a <B> | a
Which of the following sentences are in the language generated by this grammar? a. baab
b. bbbab
c. bbaaaaa
d. bbaab.
Submit your code and screen shots of the results.
LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS