Assume that $f:\mathbb{C}^n\rightarrow \mathbb{C}$ is a $C^{\infty}$ function such that $f^2$ is (complex) analytic. Then show that $f$ is analytic.
Now, when we consider the question for functions in some quasi-analytic Denjoy-Carleman class some proofs I have seen don't carry over:
Question: If $f^2$ is a function in some quasi-analytic Denjoy-Carleman class, then $f$ is quasi-analytic belonging to the same class?
Weierstrass preparation theorem doesn't hold in quasi-analytic Denjoy-Carleman classes, and it is an open problem whether a $C^\infty$ function that belongs to a quasi-analytic Denjoy-Carleman class along every line belongs to that class. Two of the proofs I have seen for the first problem break down for quasi-analytic functions for this reason.
Another open question in Denjoy-Carleman classes is about whether ideals are closed. For principal ideals this is related to solving for $f$ in $gf=h$, where $g$ and $h$ are known to belong to the Denjoy-Carleman class. The ideal generated by $g$ would not be closed if we can find a smooth $f$ that doesn't belong to the class such that it gets pushed into the class by the multiplication by $g$. In this way, the question above is about understanding whether a smooth function, not in the class, can be pushed into the class by multiplying by itself. If the square appears composed with $f$ on the other side then it is known to occur. This is, $f(x^2)$ may be in a quasi-analytic Denjoy-Carleman class while $f$ is not.
Here is the answer to your first question; I do not know anything about quasi-analytic functions to provide further input.
It suffices to consider the case where $f$ is not constant. Set $g=f^2$. Consider the subset $Z=f^{-1}(0)$. Then $Z=g^{-1}(0)$ as well. Since $g$ is assumed to be complex-analytic (this is my reading of your question), $Z$ is a proper analytic subvariety in ${\mathbb C}^n$. On the other hand, on $U= {\mathbb C}^n\setminus Z$ the multivalued function $\sqrt{g}$ is complex-analytic on $U$. The function $f$ is (locally on $U$) a branch of $\sqrt{g}$; hence, $f$ is complex-analytic on $U$. Since $f$ extends continuously to $Z$, it is complex-analytic on the entire ${\mathbb C}^n$ by the Riemann's removable singularity theorem in several variables.