We are given $f(x)=\begin{cases}x\sin\left(\frac{1}{x}\right),&x\neq0\\\\0,&x=0\end{cases}$.
First check continuity at $x=0$.
For $x\neq0$,
$-1\leq\sin\left(\frac{1}{x}\right)\leq1$
Multiplying by $|x|$ shows that $x\sin\left(\frac{1}{x}\right)$ is trapped between $-|x|$ and $|x|$.
So,
$-|x|\leq x\sin\left(\frac{1}{x}\right)\leq |x|$
As $x\to0$,
$-|x|\to0$ and $|x|\to0$
Therefore, by the squeeze theorem,
$\lim_{x\to0}x\sin\left(\frac{1}{x}\right)=0$
Since $f(0)=0$, we have $\lim_{x\to0}f(x)=f(0)$.
So $f$ is continuous at $x=0$.
Now check differentiability at $x=0$ using the definition:
$f'(0)=\lim_{x\to0}\frac{f(x)-f(0)}{x-0}$
Since $f(0)=0$,
$f'(0)=\lim_{x\to0}\frac{x\sin\left(\frac{1}{x}\right)}{x}$
$f'(0)=\lim_{x\to0}\sin\left(\frac{1}{x}\right)$
But $\sin\left(\frac{1}{x}\right)$ does not approach one fixed value as $x\to0$. It keeps oscillating between $-1$ and $1$.
Therefore, $f'(0)$ does not exist.
So $f$ is continuous at $x=0$, but not differentiable at $x=0$.
Answer: B. Continuous but not differentiable.