NEW
Font size
WorksheetsMidterm Exam - CSCI0823
Total questions: 50
Worksheet time: 38mins
Suppose that we have the following facts in student.pl
eats(leeminho, bbq).
eats(leeminho, oats ).
eats(leeminho, salad).
Identify the objects in the above facts
leeminho, salad
oats, bbq
Both a and b
None of the above
Assert the statement,
Jin is a friend of james.
assert(friend(jin,james)).
assert(friend(james,jin)).
ERROR: Undefined procedure
invalid predicate
Interpret the given code
write(15),write( ' plus '),write(10),write(' is ' ), X is 15+10 ,write(X),nl.
15 plus 10 is 25, X = 25
15 + 10 is 25, X = 25
15 plus 10, X = 25
X = 15 plus 10 is 25
Compare one of Prolog’s defining features, Prolog is a ____ language
declarative rather than a procedural
procedural rather than a declarative
declarative and procedural
None of the above
Assess that Prolog arithmetic follows MDAS
True
False
Only when using exponent
Both a and c are correct
Use the following for the database.assert(), identify the predicate symbol
parent(hank,ben).
parent(irene,ben).
parent(hank,denise).
parent(irene,denise).
parent
irene, hank
ben, denise
hank
Name the developer of the first Prolog interpreter
Phillipe Roussel
Phillipe Rousel
Phillipe Rousell
Phillipe Rossel
Compose the query to determine the parent in the given database
parent(hank,ben).
parent(irene,ben).
parent(hank,denise).
parent(irene,denise).
?- parent(X,_).
?- parent(X,ben).
?- parent(_,_).
?- parent(X).
Discover the variable in the given instance
write(Top+Middle+Bottom),nl,fail.
Top
Middle
Bottom
All of the above
Suppose that we have the following facts in exam.pl
likes(fred,pears).
likes(fred,t_bone_steak).
likes(fred,apples).
Analyze the use of fred
object
variable
Both a and b
Predicate symbol
Using Prolog arithmetic, solve for
?- 5 is 6 -1.
true
false
5
X = 5
Prolog contains facts and rules. Inspect the facts in the following:
eats(loren,apple).
long_hair(miley).
Both given are facts
loren, apple
miley
eats and long_hair
Prolog answered “true” in the given query. Interpret the use of ASSERT function in the given statement
?- midterm_exam.
true.
?- assert(midterm_exam.).
?- assertz(midterm_exam.).
Assert(midterm_exam.).
Asserta(midterm_exam.).
Formulate the children of hank and irene in the database below
parent(hank,ben).
parent(irene,ben).
parent(hank,denise).
parent(irene,denise).
?- parent(_,Children).
?- parent(X,ben).
?- parent(X,denise).
?- parent(Children).
In the beginning of the given database,
parent(hank,ben).
parent(irene,ben).
parent(hank,denise).
parent(irene,denise).
Add
parent(hank,leo)
as the last statement
assertz(parent(hank,leo)).
asserta(parent(leo,hank)).
retract(parent(hank,leo)).
assert(parent(hank,leo)).
Match the English interpretation of
?-friend(nadine, james).
Nadine is a friend of James.
James is a friend of Nadine.
Nadine and James are friends.
None of the above
Infer the result of
?- assert(csci0823(midterm,exam)).
True
False
csci0823(midterm,exam).
Unknown Predicate
Extend the cause of error in line number
?- [parent_db.txt].
ERROR: Syntax error: Operator expected
No single quotes
No double quotes
The extension name must be .pl
The use of underscore
Refer to the given database
parent(hank,ben).
parent(irene,ben).
parent(hank,denise).
parent(irene,denise).
Choose the cause of error in line number
9 ?- parent(Parents).
ERROR: Undefined procedure: parent/1
ERROR: However, there are definitions for:
ERROR: parent/2
The arity of predicate parent is only 1
The arity of predicate parent should be 1
The arity of predicate parent should be 2
parent is not a predicate symbol
Translate the English statement below into Prolog fact
I will pass this exam.
will_pass(i, exam).
will_pass(I, this_exam).
Pass(i, exam).
pass(i, Exam).
Recommend a query from this unification
book(1,title1,author1).
?- book(_,_,author1).
?- book(_,X,author1).
Both a and b are correct
Neither a or b is correct
Make use of Prolog interpreter, negate that the weather is sunny
?- assert(sunny).
?- retract(sunny).
?- sunny.
?- not_sunny.
Relate the given English statement into Prolog rule
I will pass the examination if I have reviewed the lectures and lab activities.
pass(I, Examination) :- reviewed(I, Lectures), reviewed(I, Lab_activities).
pass(I, Examination) :- reviewed(_, Lectures), reviewed(_, Lab_activities).
pass(I, Examination) :- reviewed(I, _), reviewed(I, _).
None of the above
Apply the English statement
Mitch likes ice cream.
into Prolog fact
likes(mitch,ice_cream).
likes(Mitch,ice_cream).
likes(Mitch,Ice_cream).
Likes(mitch,ice_cream).
Translate the English meaning of
professor(X, Y) :- teaches(X, C), studies(Y, C).
Y is a professor of X if X teaches C and Y studies C.
X is a professor of Y if X teaches C and Y studies C.
X is a professor of Y if X and Y teach and study C.
None of the above
After adding “sunny”, prove that it is sunny in Prolog interpreter
?- sunny.
?- retract(sunny).
?- assert(sunny).
?- sunny(true).
Predict the cause of error in line number
5 ?- assert(likes(maria.ice_cream)).
ERROR: Syntax error: Operator expected
period
comma
parenthesis
predicate symbol
Simplify ?- X is 11/5 in Prolog arithmetic
X = 2.2
.2
2
X = 2
Identify the cause of error in line number
3 ?- assert(parent(hank denise)).
ERROR: Syntax error: Operator expected
period
comma
parenthesis
predicate symbol
Given a database named vegie.pl, determine the number of clauses
vegetarian(jose).
vegetarian(james).
vegetable(carrot).
vegetable(egg_plant).
likes(jose, X) :- vegetable(X).
loves(Who, egg_plant) :- vegetarian(Who).
4
3
2
6
Originate the arity in
write(‘Prolog’),nl.
1
0
nl
write
Predict the subgoal in
cone(Top, Middle, Bottom) :- scoop(Top), scoop(Middle), scoop(Bottom).
scoop(Top), scoop(Middle), scoop(Bottom).
cone(Top, Middle, Bottom).
Top, Middle, Bottom
scoop
Conjunction means ____ , in Prolog it is written as ____
And , Comma(,)
Or , Comma(,)
And , Semicolon(;)
Or , Semicolon(;)
In Plankalkül syntax, V represents
subscript
data type
variable
Fortran 0 was developed but was never implemented
True
False
LISP is a functional programming language
True
False
In LISp, Nil means
next
pointer
node
null
The design of this language is based on the concept of orthogonality
ALGOL 68
ALGOL 60
Fortran II
Fortran IV
First full implementation of an object-oriented language
Java
C#
Smalltalk
C++
In ______, servlet’s output is displayed by the browser
XSLT
JSP
PHP
Python
The popularity of this language suffered because the DoD no longer requires its use but also because of popularity of C++
C
C#
Java
Ada 95
Smalltalk
In this notation, the operator is written ahead of operands.
Postfix
Prefix
Mixfix
Infix
Convert the expression below to prefix form
( (A * B) + (C / D) )
(+ (* A B) / C D )
(+ (* A B) (/ C D) )
+ (* A B) (/ C D)
Convert the expression below to infix form
a b + c d + *
(a + b) * c + d
a + b * c + d
(a + b) * (c + d)
Stack data structure is applied in _____ notation
Prefix
Mixfix
Postfix
Prefix
Determine the postfix form of the given expression
( ( AX + ( B * CY ) ) / ( D E ) )
AX B CY * + / D E
AX B CY * + D E /
/ + AX * B CY D E
AX B CY * D + E /
Convert
AX B C * +
to prefix form
+ * AX B C
AX + * B C
A + X * B C
+ AX * B C
Recall the course policies and standards. Submission of copied laboratory exercise, case studies and laboratory exams will be graded as __.
zero
50%
70%
74%
State the missing part in the university mission statement
To develop__________________ and empowered community members by providing relevant innovative and transformative knowledge, research, extension and production programs and services through progressive enhancement of its human resource capabilities and institutional mechanisms
competitive graduates
qualified graduates
intelligent graduates
competitive and qualified graduates
Define the missing parts in the university vision statement
A leading university in the Philippines recognized for its proactive contribution to sustainable development through __ programs and services by 2030
equitable and inclusive
inclusive
equitable
inclusive and equitable
