Beruflich Dokumente
Kultur Dokumente
Q1#What are the main differences between the procedural programming languages
and the descriptive programming language (with examples).
Q2# There are many uses for Prolog programming language, what are they?
Q3# There are only three basic elements in Prolog program, describe them with
examples.
Q5# Convert the following sentences to its corresponding facts or rules in Prolog:
Q7# Prolog language supports several data type to define program entries, what are
they? Describe with example.
Q8# What is the output for the following program?
predicates
f(string,string)
gf(string,string)
clauses
f("ali","zaki").
f("mohamed","ali").
f("ali","ahmed").
f("zaki","suha").
gf(X,Y):- f(X,Z), f(Z,Y).
goal
gf(X,Y).
degree(ali,X).
degree(X,Y).
degree(_,Y).
degree(_,_).
degree(X,Y), Y>=50.
degree(Ahmed,X).
degree(suha,X).
If you have the following facts:
degree(suha,40).
degree(ali,50).
degree(ahmed,30).
degree(suha,55).
Q12# Write prolog program to read an integer number and test it, if the number>65
then return its corresponding character, otherwise print the number itself.
start(integer,integer)
a(integer)
b(integer)
clauses
a(10).
a(20).
b(30).
b(20).
b(40).
start(X,Y):-a(X),b(Y), X<=10,Y>=30.
goal
start(X,Y).
Q14# compare between cut and fail using examples
i =integer
s = symbol
Predicates
a(i )
b (s )
c (i, s )
Clauses
a(10).
a(20).
a(30).
b(a).
b(c):-!.
b(d).
Goal
c(X,Y).
lecture5: recursion
Q16#Convert the following prolog program from tail recursion to non-tail recursion.
Domains
I= integer
L=I*
Predicates
sum (L,I, I)
Clauses
sum ([],S,S):-!.
sum([H|T],X,S):- X1 = X+H , sum (T,X1,S).
Goal
sum ([ 1,4,6,9],0 ,S).
Q17# Write a prolog program that can find the multiplication of odd numbers from
1 to 5 using non tail recaursion. (with tracing)
Q18# Write a prolog program that can find the summation of odd numbers in a
given list using tail recursion. (with tracing)
Q19# Show the difference between tail and non-tail recursion (using an example).
Q20# What is the output to the following prolog program?
Domains
I=integer*
predicates
check(l).
clauses
check([]).
check ([H|T]):- check (T),write(H),nl.
goal
check([1,2,3,4]).
Lecture6: list
Q21# Write a prolog program to split a list into an even list and an odd list.
Q22#write a prolog program that repeat reading integer numbers and putting them in a
list until the input number is equal to zero.
Q23#Write a prolog program that can delete an element from a list, such as if your goal is
del(5,[1,3,5,4,5],L), then the output will be L=[1,3,4].
Q25#Find the average of the even numbers in a given list using non tail recursion.
Q28#Suppose you have the following sentence “work hard in silent and let your
success make the noise”, write a prolog program to convert this sentence to a
list of words.
Q29# Describe with examples five standard string predicates found in prolog.
Lecture8: introduction to AI
Q30#Answer the following:
What are the main goals of AI research?
Give two different definitions for AI?
What are the main AI applications?
What do we mean by intelligence?
What are the main fundamental issues of AI?
What are knowledge representation schemes?