1.Describe how a multiple-processor machine could be used to implement resolution. Could Prolog, as currently defined, use this method?
2.Explain two ways in which the list-processing capabilities of Scheme and Prolog are similar.
3.In what way are the list-processing capabilities of Scheme and Prolog different?
4.Suppose you want to write a method that prints a heading on a new output page, along with a page number that is 1 in the first activation and that increases by 1 with each subsequent activation. Can this be done without parameters and without reference to nonlocal variables in Java? Can it be done in C#?
5.Consider the following program written in C syntax:
void swap(int a, int b) {
int temp;
temp = a;
a = b;
b = temp;
}
void main() {
int value = 2, list[5] = {1, 3, 5, 7, 9};
swap(value, list[0]);
swap(list[0], list[1]);
swap(value, list[value]);
}
For each of the following parameter-passing methods, what are all of the values of the variables value and list after each of the three calls to swap?
6.Consider the following program written in C syntax:
void fun (int first, int second) {
first += first;
second += second;
}
void main() {
int list[2] = {1, 3};
fun(list[0], list[1]);
}
For each of the following parameter-passing methods, what are the values of the list array after execution?
1.Write a Prolog program that finds the maximum of a list of numbers.
2.Write a Prolog program that returns a list containing the union of the elements of two given lists.