Let $f: Z \rightarrow Z$ be given by $f(x)=\left\{\begin{array}{l}\frac{x}{2}, \text { if } x \text { is even } \\ 0, \text { if } x \text { is odd }\end{array}\right.$
Then, f is
(a) onto but not one-one
(b) one-one but not onto
(c) one-one and onto
(d) neither one-one nor onto
Injectivity:
Let x and y be two elements in the domain (Z), such that
$f(x)=f(y)$
Case-1: Let both $x$ and $y$ be even.
Then,
$f(x)=f(y)$
$\Rightarrow \frac{x}{2}=\frac{y}{2}$
$\Rightarrow x=y$
Case-2: Let both $x$ and $y$ be odd.
Then,
$f(x)=f(y)$
$\Rightarrow 0=0$
Here, we cannot determine whether $x=y$.
So, $f$ is not one-one.
Surjectivity:
Let y be an element in the co-domain (Z), such that
Co-domain of $f=Z=\{0, \pm 1, \pm 2, \pm 3, \pm 4, \ldots\}$
Range of $f=\left\{0,0, \frac{\pm 2}{2}, 0, \frac{\pm 4}{2}, \ldots\right\}=\{0, \pm 1, \pm 2, \ldots\}$
$\Rightarrow$ Co-domain of $f=$ Range of $f$
$\Rightarrow f$ is onto.
So, the answer is (a).