It is well-known that the solutions of $$|M-\lambda I|=0$$ are purely real if $M$ is real symmetric.
Conjecture This is still true if we replace the identity matrix by a diagonal matrix $D$ whose diagonal elements are either $0$ or $1$:
$$\left. \begin{matrix}|M-\lambda D|=0 \\ M\text{ is real symmetric}\\M\text{ and }D\text{ do not have a common nullspace}\end{matrix}\right\}\implies \lambda \in \mathbb{R}\text{ (if a solution exists)}$$
Partial proof
Without loss of generality we can assume $$D=\text{diag}(1,1,\cdots,1,1,0,0,\cdots,0,0)$$
If $M$ is symmetric, $$|M-\lambda D|=\left|\begin{matrix}M_1-\lambda I & M_2 \\ M_2^T & M_3\end{matrix}\right|$$ with $M_1,M_3$ symmetric. If $M_3$ is invertible, $$\left|\begin{matrix}M_1-\lambda I & M_2 \\ M_2^T & M_3\end{matrix}\right|=|M_3||M_1-M_2 M_3^{-1}M_2^T -\lambda I|$$ $|M_3|\neq 0$ by hypothesis, so $$|M-\lambda D|=0\implies |M_1-M_2 M_3^{-1}M_2^T -\lambda I|=0$$ thus $\lambda$ is an eigenvalue of the symmetric matrix $M_1-M_2 M_3^{-1}M_2^T$, and is therefore real.
Question
What if $M_3$ is not invertible? The condition that $M_3$ is invertible does not appear to be necessary, for example $$\left| \begin{array}{ccc} e-\lambda & a & b \\ a & d-\lambda & c \\ b & c & 0 \\ \end{array} \right|=0$$ has a single real solution. Another example, where $M_3$ is $2\times 2$ and nonzero: $$\left| \begin{array}{cccc} 1-\lambda & 2 & 5 & 4 \\ 2 & 1-\lambda & 3 & 6 \\ 5 & 3 & 1 & 1 \\ 4 & 6 & 1 & 1 \\ \end{array} \right|=0$$ $$\lambda=-\frac{151}{5}$$