Order of an element is smallest positive integer x,such that ${a^x}=e$
As given ${a^8}=e$ ,it means order of an element cannot be more than 8.
8 is not the order and it is not identity element so order 1 and 8 order are not possible.Also,2 is not the order.
We are left with 3,4,5,6,7
As ${a^8}=e$ ,so order must be some multiple of 8,otherwise we will not get ${a^8}=e$
so only option which satisfy is 4
hence,4 is the order of g