Definition of square root symbol - $\sqrt{x^2}=?$
Let's try with a number to see where the mistake is. Let's look at $f(4)$.
Then $f(4)$ = $\sqrt{16} = 4$, and we need to make sure that the options in C and D also give $4$.
In C, we get $4 = |4|$. So that works.
In D, we get $\pm 4$, which is a pair of numbers, both $4$ and $-4$. Well, $\pm 4 \neq 4$. In fact, there are two numbers on the left and only one on the right. So D is not right at all.
The problem is convention. The square root is part of a more general problem of finding the "roots" of number (here $n$ is an integer $> 1$). There are two ways to write the root of a number:
$$ x^n = a \rightarrow x = \sqrt[n]{a}\text{ or } x = a^\frac{1}{n} $$
If you study complex analysis you will find that every number, real and complex, other than $0$ has exactly $n$ distinct roots. When you write $a^\frac{1}{n}$ you mean all roots (so this is not a function--it has many values) and when you write down $\sqrt[n]{a}$ you mean the single, positive, real value (here $a \geq 0$ and must be real).
Therefore when you do $\sqrt{x^2}$ it must always return a positive value...which is the absolute value. The problem is the fact that $x^2 = \left|x\right|^2$ so it could have just as easily been $\sqrt{x^2} = x$ or $\sqrt{\left|x\right|^2} = \left|x\right|$. But since you know, in general $\sqrt{x^2} = \pm x$, you choose the appropriate one...which is always the positive value--the absolute value.
Btw, notice that:
$$ \sqrt{x^2} =\left|x\right| = \begin{cases} x & x> 0 \\ -x & x < 0 \\ 0 & x = 0\end{cases} $$
So your solution does involve $\pm x$ (i.e. sometimes it's $+x$ and sometimes it's $-x$).
Actually, there seems to be some ambiguity: one may have in mind that square root of $a$ denote the solution of $x^2=a$, and since there are two solutions, square root is a multivalued function. But unless you are willing to do some complex analysis and study Riemann surfaces, it's a bad idea to go along that way.
So there is the definition of square root on $[0, +\infty[$: $\sqrt{a}$ is always the nonnegative solution of $x^2=a$.
Simply put, $\sqrt{x^2}=|x|$, not $\pm x$. The latter, being multivalued, is not even a function in the standard sense.
$f(x)=\pm x$ is not a function if the domain is not $\{0\}$.
$\sqrt{\cdot}:\mathbb{R}^+\to\mathbb{R}^+$ is the "squared root" domain and codomain. That is, it is the principal square root.
To answer your question, yes it could be both. The important theme to consider is that a function is not just a "rule," because the domain is also a defining characteristic of a function.