Week 11

1 The base value types available in Prolog include:
1) atoms
2) lists
3) numbers
4) strings
5) None of the above
2 Prolog rules/clauses/facts with the same name
1) Must always appear together in the Prolog source code.
2) Are always part of the same predicate.
3) Must have different formal parameters.
4) Must always have variables as part of their formal parameters.
5) None of the above
3 Which of the following Prolog statements gives "X" the value of 4 more than "Y"?
1) X =:= Y + 4
2) X == Y + 4
3) X = Y + 4
4) X is Y + 4
5) None of the above
4 If the expression "[ a, [ b, c], d ]" is matched to the expression "[ X | Y]" in Prolog, which of the following bindings are true?
1) X = [ a, [ b ] ]
2) X = [ a, [ b, c ] ]
3) X = [ a ]
4) X = [ a, [ b, c], d ]
5) None of the above
9 Which of the following is not a feature of Prolog?
1) Backtracking
2) Unification
3) Pattern matching
4) Variable/Parameter instantiation
5) None of the above
10 A primary difference between Prolog programs from those of other languages (e.g., Lisp, C++, Java) is
1) Variables/Parameters cannot be assigned values
2) It doesn't support garbage collection
3) There is no distinction between predicate input and output
4) It supports recursion
5) None of the above
12 Which of the following queries would succeed based on the following predicates? pred([ ], X, X). pred([ H | T ], X, Y) :- pred(T, [ H | X ], Y). pred(X, Y) :- pred(X, [ ], Z).
1) pred([b, c], [c, b, a]).
2) pred([a, b, c], [a, b, c]).
3) pred([a, b, c], [c, b, a]).
4) pred([a, b, c], [b, a]).
5) None of the above
13 Which of the following queries would succeed based on the following predicates? pred(X):- pred(X, X). pred([ ], [ ]). pred([ X | Y ], Z):- pred(Y,Tmp), append(Tmp, [ X ], Z).
1) pred([a]).
2) pred([a, b]).
3) pred([a, b, c]).
4) pred([a, b, b, a]).
5) None of the above
14 Which of the following queries would succeed based on the following predicates? pred(X, [X | _]). pred(X, [_ | Y]) :- pred(X, Y).
1) pred(a, [b, c, d]).
2) pred([a], [ [b], [c], [d] ]).
3) pred([a], [a, b, c, d]).
4) pred([a], [ [a], [b], [c], [d] ]).
5) None of the above
15 Which of the following queries would succeed based on the following predicates? pred( _, []). pred(X, [ Y | Z ]) :- X \= Y, pred(X, Z).
1) pred(a, [b, c, d]).
2) pred([a], [ [b], [c], [d] ]).
3) pred([a], [a, b, c, d]).
4) pred([a], [ [a], [b], [c], [d] ]).
5) None of the above
{"name":"Week 11", "url":"https://www.quiz-maker.com/QPREVIEW","txt":"1 The base value types available in Prolog include:, 2 Prolog rules\/clauses\/facts with the same name, 3 Which of the following Prolog statements gives \"X\" the value of 4 more than \"Y\"?","img":"https://www.quiz-maker.com/3012/images/ogquiz.png"}
Powered by: Quiz Maker