Answer
3.
%rule remdup(List1,List2) that takes as input List1 and produces
as output List2.
%List2 contains all items that appear in List1,
%except the repeated or duplicate items.
%if the List1 is empty, return the empty list. Base case.
remdup([],[]).
%if the first element of List1 is anywhere in the rest of List1,
then call remdup
%with the rest of List1 as input.
remdup([H|T],C):- member(H,T),remdup(T,C).
%if the first element of List1 is not anywhere in the rest of
List1, then append it to List2
%and call remdup with the rest of List1 as input.
remdup([H|T],[H|C]):-
not(member(H,T)),remdup(T,C).
Sample Output

4.
%find all the direct prerequisites of the course.
prereqs(C,R):- requires(C,R).
%find all the indirect prerequisites of the course.
prereqs(C,R):- requires(C,R0),prereqs(R0,R).
%find all the prerequisites of the course.
allreqs(C,L):-
setof(C1,prereqs(C,C1),L).
Sample Output

Solve above using prolog!! 3. 2 marks] Write the rule remdup (List1, List2) that takes as input List1 and produces as o...