Composition of convex functions is not necessarily convex and $e^{-x^2}$ is a counterexample to this, being the composition of $x^2$ and $e^{-x}$. However, if $f: \mathbb{R}\rightarrow \mathbb{R}$ is convex non-decreasing and $g: \mathbb{R}^n\rightarrow \mathbb{R}$ is convex, then $f\circ g$ is also convex.

The criterion for the convexity of $C^2$ functions $\mathbb{R}^n\rightarrow \mathbb{R}$ goes as follows:

  1. If $f$ is convex, then it has everywhere positive semi-definite Hessian.
  2. If $f$ has everywhere positive definite Hessian, then $f$ is strictly convex.

An analogous principle is true for concave functions.

One can easily check that $f=e^{-\|x\|^2}$ has positive semi-definite Hessian at some points (far from the origin) and negative semi-definite Hessian at some other points (close to the origin). Thus $f$ is neither convex everywhere nor concave everywhere.