Christopher T. answered 10/11/21
Former Discrete Math instructor at Wright College
As you suspected, if f:Z→Z where f(x)=2x+34, it will always be an even integer. Therefore, the image of our domain Z under f is f(Z) = 2Z (the even integers), which is not the same as the codomain Z that is specified in the definition of f. Since f(Z)≠Z, f can not be onto. A quicker way to conclude that f is not onto here is by finding an example showing that there is an value in your codomain that f(x) doesn't hit; for example, you could say that there does not exists an x∈Z such that f(x)=1 and this would be sufficient in showing that f is not onto.
On the other hand, it is one-to-one and hopefully that isn't too difficulty for you to show.