1. Using Prolog as the programming language for LOGIC, construct the relevant command to do the following tasks:-
Prolog Lists - A list is either empty or it is composed of a 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 denotes the head and T denotes the tail.
(NOTE:- Given list MySenarai= [a,b,c,d,e,f, g, h] for the tasks listed below)
i. Find the last element of a list.
ii. Find the K'th element of a list. (K=5)
iii. Eliminate consecutive duplicates of list elements.
iv. Find the number of elements of a list.