SQNR and Dynamic Range
I got to this solution:

Starting from SQNR formula:
\begin{equation}
\text{SQNR} = 10log(\frac{A^2/2}{q^2/6})
\end{equation}
simplified:
\begin{equation}
\text{SQNR} = 4.77 + 20log(\frac{A}{q})
\end{equation}
As,
\begin{equation}
q = \frac{2*V_{max}}{2^N}
\end{equation}
\begin{equation}
\text{SQNR} = 4.77 + 20log(\frac{2^NA}{2V_{max}})
\end{equation}
\begin{equation}
\text{SQNR} = -1.25 + 6.02N + 20log(\frac{A}{V_{max}})
\end{equation}
Dynamic range in this case:
\begin{equation}
\text{DR} = 20log(\frac{V_{max}}{A})
\end{equation}
Substitution:
\begin{equation}
40 = -1.25 + 6.02N - 15
\end{equation}
\begin{equation}
N = 9 \text{ bits (ceiling function)}
\end{equation}

I would appreciate if someone can give his approval!