Answer
a-D is not one-to-one
b-D is onto
Work Step by Step
$D:S\rightarrow \mathbb{Z} (S\,is\,the\,set\,all\,strings\,of\,0\,s\,and\,1\,s)\\
D(s) =the number\,of\,1\,s\,in\,s\,minus\,the\,number\,of 0\,s\,in\,s \\
a-\\
A\,function\,\,D: S \rightarrow \mathbb{Z}\,is\,not\,\,\,one-to-one\,\Leftrightarrow \\
\exists \,\,x_{1}\,and\,x_{2}\,\,in\,\,S\,\,such\,that\,\,
D(x_{1}) = D(x_{2})\,\,and x_{1} \neq x_{2}.\\
we\,can\,see\,that\,D(100)=l(010)=-1\,\,and\,100\neq 010 \\
so\,D\,is\,not\,one-to-one\\
b-\\
l: S \rightarrow \mathbb{Z}\,\,is\,\,onto\,\Leftrightarrow \,\\
\forall y\,in\,\mathbb{Z} ,\exists x \in S\,such\,that\, l(x) = y.\\
proof:\\
if\,y=0\,there\,is\,s=10 \,such\,that\,D(10 )=0\\
if\,y=n> 0\\
let\,s=1111...1\,(n\,times.)\,such\,that\,D(1111...1 )=n \\
if\,y=n< 0\\
let\,s=0000...0\,(n\,times.)\,such\,that\,D(0000...0 )=n \\
so\,D\,is\,onto
$