[SOLVED] 程序代写 CPS 721 Quiz 2

30 $

File Name: 程序代写_CPS_721_Quiz_2.zip
File Size: 254.34 KB

SKU: 5732029773 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


CPS 721 Quiz 2
2021 Practice Version
(not shared) Switch account
Evaluating a Query in Prolog

Copyright By PowCoder代写加微信 assignmentchef

Refer to the knowledge base below for the following questions.
1. p(2,2,4).
2. p(4,2,6).
3. p(3,3,6).
4. q(2,2).
5. q(3,3).
6. q(X,Y):- p(Z,Y,X), q(Z,Y).
Questions are marked automatically; be sure to follow the specified format when responding to short- answer questions.
Record the order in which the numbered lines from the knowledge base are applied when the query ‘?- q(6,Y).’ is evaluated in Prolog. Use a comma to separate the numbers. Do not use spaces. Example: 1,2,3
Your answer
For the query ‘?- q(6,Y)’ what is the first value for Y that Prolog would produce? Enter an integer only.
Your answer
Evaluating an Arithmetic Query
What would Prolog answer for the following query?

?- X = 2 + 1, Y = 5, Y is X + 2
X = 2 + 1, Y = 2 + 1 + 2
Error: variables are not sufficiently instantiated X = 3, Y = 3 + 2
The query would fail
X = 3, Y = 5
X = 2 + 1, Y = 5
Constructing an Arithmetic Query
Choose the portion of a Prolog query which will correctly perform the specified computations. Assume that both X and Y already have integer values from earlier in the query.
Multiply X by 2, and multiply Y by 3. Ensure that the sum of the resulting values is less than 100.
X1 = X*2, Y1 = Y*2, Z is X1+Y1 < 100. Z = (X*2) + (Y*3), not Z == 100.X1 = 2*X, Y1 = 2*Y, X1+Y1 < 100.99 = 2*X+3*Y.X is 2*X, Y is 3*Y, 100 > X+Y.
X1 is X*2, Y1 is Y*3, Z is X1+Y1, Z < 100.Never submit passwords through Google Forms.This form was created inside of. Report AbuseClear form程序代写 CS代考加微信: assignmentchef QQ: 1823890830 Email: [email protected]

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] 程序代写 CPS 721 Quiz 2
30 $