Considering x belongs to {a,b}*. Domain is {a,b,aa,ab,ba,bb,...} and range is also {a,b,aa,ab,ba,bb,...} . Suppose x1 and x2 are different elements in domain which map to the same element in range then f(x1)=f(x2)
implies a*x1=a*x2
implies x1=x2. This means x1 and x2 are same i.e. no two elements in domain will map to the same element in range. So f is one-one.
Now, a function is said to be onto if every element in range set has a pre image in domain set(no element in range set should be left out)
Here,f is not onto because for element b in range, there is no pre-image in domain.
So answer should be A