Utilizing the Prolog as the programming language for the LOGIC, form the relevant command in order to perform the following tasks:-
Prolog Lists - A list is either empty or it comprises of the first element (head) and a tail, which is a list itself. In Prolog we represent the empty list by the atom [] and a non-empty list by a term [H|T] where H signify the head and T denotes the tail.
Given list MySenarai= [a, b, c, d, e, f, g, h] for the tasks listed below.
a) Determine the last element of a list.
b) Determine the K'th element of a list. (K=5)
c) Remove the consecutive duplicates of the list elements.
d) Determine the number of elements of the list.