15 Questions
Which of the following arithmetic functions is available in Prolog?
Square root
In Prolog, what must be true for variables appearing in an arithmetic expression?
They must already be bound with values
What is the result of the arithmetic expression in Prolog: $Y = 10, Z = Y + 1$?
Y=10, Z=11
Which of the following is an arithmetic operator in Prolog?
/ (division)
What does Prolog use to specify the order of operations in arithmetic expressions?
Parentheses
Which of the following is a relational operator in Prolog?
== (equality)
What is the value of X when X = 10 mod 4?
2
What is the solution when X = 30, Y = 5, and Z = X + Y + X*Y?
185
What is the result of the arithmetic expression 6+4?
10
What is the outcome of the append operation append([1,2,3,4],[5,6,7,8,9],L)?
[1,2,3,4,5,6,7,8,9]
What is the value of sqrt(36)?
6.0
What does the predicate 'prefix(P,L):append(P,_,L)' define?
Finding prefixes of a list
What are the values of L1 and L2 in the operation append(L1,L2,[1,2,3])?
[], [1,2,3]
What is the value of X when X = 1 + 2?
3
What does the statement 'If the first two arguments L1,L2 are lists and the third argument is an variable, the third argument is bound to a list comprising the first two lists concatenated' describe?
Appending two lists
This quiz covers the topic of arithmetic in Prolog, including arithmetic operators, functions, examples, and operator precedence in arithmetic expressions. Taught by Prof. Dr. Abeer Mahmoud from Ain Shams University's Faculty of Computer and Information Sciences.
Make Your Own Quizzes and Flashcards
Convert your notes into interactive study material.
Get started for free