Question

In: Computer Science

1.What will the result of this form be? (cadr ‘(1 2 3 4 5 6)) a....

1.What will the result of this form be? (cadr ‘(1 2 3 4 5 6))

a. '(1 2 3 4 5 6)

b. 2

c. '(2 3 4 5 6)

d. 1

.

2.How does Prolog try to resolve our Queries?

a.The programmer specifies the algorithmic approach, performance is all in the hands of how clever the programmer writes their algorithms.

b.The language applies some AI to our query and precludes obviously false information.

c.Row by agonizing row. There is nothing particularly clever about the solve, it just brute forces its way through the data looking for resolutions.

Solutions

Expert Solution

1.answer: b. 2

explanation:


;To make it simple to understand let's get it from scratch

;semicolons ; represents comments

;cadr is a combination of car&cdr i.e car(cdr(list))

;car and cdr are list operations

;cdr takes out the first element from the list and returns rest elements

;as a new list

;so cdr(1 2 3 4 5 6) is (2 3 4 5 6)

;car(list) always retrieves the first element from list

;as said earlier cadr is combination so

;car here is being implement on above list

;car(2 3 4 5 6) return first element i.e 2

;so answer is 2

(cadr '(1 2 3 4 5 6))

2. answer:  c.Row by agonizing row. There is nothing particularly clever about the solve, it just brute forces its way through the data looking for resolutions.

explanation:

Option A:The programmer specifies the algorithmic approach, performance is all in the hands of how clever the programmer writes their algorithms.
The unique feature in prolog automatically finds the facts and rules to solve a query so there is not much involvement of programmer's algorithm approach to solve the query in prolog.So this option is incorrect

Option B:The language applies some AI to our query and precludes obviously false information.
In fact Prolog is the oldest programming language,Back then there was no AI to use on query.So in this perspective we can cross over this option. Incorrect

Option C:Row by agonizing row. There is nothing particularly clever about the solve, it just brute forces its way through the data looking for resolutions.

We cannot say it's a brute force way,But prolog automatically choose facts and rules to resolve a query row by row in a list.
so this option is correct

**************************************************************************
Please give an upvote,as it matters to me a lot :)
Got any doubts? Feel free to shoot them in the comment section
**************************************************************************


Related Solutions

ID X Y 1 2 3 2 3 6 3 4 6 4 5 7 5...
ID X Y 1 2 3 2 3 6 3 4 6 4 5 7 5 8 7 6 5 7 7 6 7 8 8 8 9 7 8 10 12 11 Test the significance of the correlation coefficient. Then use math test scores (X) to predict physics test scores (Y).  Do the following: Create a scatterplot of X and Y. Write the regression equation and interpret the regression coefficients (i.e., intercept and slope). Predict the physics score for each....
[4 5 5 2 4 4 6 3 3 7 5 3 6 3 4 4...
[4 5 5 2 4 4 6 3 3 7 5 3 6 3 4 4 6 5 4 5 3 7 5 5 4 2 6 5 6 6] This is my dataset Find mean, median, mode, variance, standard deviation, coefficient of variation, range, 70th percentile, 3rdquartile of the data and skewness and define what each of these statistics measure. For example, mean is a measure of the central tendency, what about the rest? Use Chebyshev’s rule to find...
[4 5 5 2 4 4 6 3 3 7 5 3 6 3 4 4...
[4 5 5 2 4 4 6 3 3 7 5 3 6 3 4 4 6 5 4 5 3 7 5 5 4 2 6 5 6 6] This is my dataset Split the dataset in two equal parts. You have 30 datavalues. If you split the data in two equal parts each part will contain 15 data values.  Call the first part Y and second part X.Draw scatter plot of the 2 datasets, X being on the horizontal...
tens Units 1 5 2 3 4 8 5 2 5 6 9 6 1 3...
tens Units 1 5 2 3 4 8 5 2 5 6 9 6 1 3 5 4 7 9 7 0 0 4 5 6 9 9 8 1 3 5 6 8 9 9 0 1 2 3 5 9 The table represent a random sample of 31 test scores taken from a large lecture class. Find the following [round to 2 decimal points X. XX] a) [2 pts] Find the 5 number summary [L, Q1, Q2, Q3,...
Matrix A2= [1 2 3; 4 5 6; 7 8 9; 3 2 4; 6 5...
Matrix A2= [1 2 3; 4 5 6; 7 8 9; 3 2 4; 6 5 4; 9 8 7] Note: TA2 is defined to be a linear transformation that maps any vector x to A2* x. That is TA2 = A2*x. Also the range of the Linear transformation represented by A2 is the same as the column space of A2. l) Find a basis for the null(TA2). m) Find nullity of A2, TA2 and A2tA2. n) Find rank(A2), rank(A2t),...
X 1 3 5 3 4 4 Y 2 5 4 3 4 6 A: Plot...
X 1 3 5 3 4 4 Y 2 5 4 3 4 6 A: Plot the date B: find the line of best fit C: determine ŷ AT x=3 D: Find r and r^2 E: explain r and r^2
2. Consider functions f : {1, 2, 3, 4, 5, 6} → {1, 2, 3, 4,...
2. Consider functions f : {1, 2, 3, 4, 5, 6} → {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}. (a) How many of these functions are strictly increasing (i.e. f(1) < f(2) < f(3) < f(4) < f(5) < f(6))? Hint: How many different possibilities are there for the range of f? For each range of f, how many strictly increasing functions are there? (b) How many of these functions are non-decreasing (i.e. f(1) ≤ f(2) ≤...
1. What will print? int[][] numbers = { { 1, 2, 3, 4 },{ 5, 6,...
1. What will print? int[][] numbers = { { 1, 2, 3, 4 },{ 5, 6, 7, 8 },{ 9, 10, 11, 12 } }; System.out.println(numbers[1][3]); a) 13 b) 4 c) 8 d) 12 2. With what value does currYear = yearsArr[2] assign currYear? int[ ] yearsArr = new int[4]; yearsArr[0] = 1999; yearsArr[1] = 2012; yearsArr[2] = 2025;          a) 4 b) 1999 c) 2012 d) 2025 3. What will print? String [][] names = { { "Elliot", "Darlene", "Angela",...
Year Promisedcash flows Expectedcash flows 1 6 5 2 6 5 3 6 5 4 6...
Year Promisedcash flows Expectedcash flows 1 6 5 2 6 5 3 6 5 4 6 5 5 6 5 6 6 5 7 6 5 8 6 5 9 6 5 10 106 95 What is the present value today of promised cash flows at 6%? If the price of the bond is 80, what is the yield to maturity of the bond using the promised cash flows? What is the present value today of the expected cash flows...
exampleInput.txt 1 2 3 0 2 3 4 0 1 3 5 0 1 2 6...
exampleInput.txt 1 2 3 0 2 3 4 0 1 3 5 0 1 2 6 1 5 6 8 2 4 6 7 3 4 5 9 10 5 8 9 4 7 9 6 7 8 6 How can I detect when 'cin' starts reading from a new line. The amount of numbers in each row is unknown. I need them in type 'int' to use the data.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT