4. Roll a die twice, and let $X$ denote the maximum of the two rolls. Then, among the following numbers, the one closest to the expectation $\mathrm{E}(X)$ is ( ).
(A) 4
(B) $4 \frac{1}{2}$
(C) 5
(D) $5 \frac{1}{2}$
4. B.
$$
\begin{array}{l}
\text { It is easy to see that } P(X=1)=\frac{1}{36}, \\
P(X=2)=\frac{4}{36}-\frac{1}{36}=\frac{3}{36}, \\
P(X=3)=\frac{9}{36}-\frac{4}{36}=\frac{5}{36}, \\
P(X=4)=\frac{16}{36}-\frac{9}{36}=\frac{7}{36}, \\
P(X=5)=\frac{25}{36}-\frac{16}{36}=\frac{9}{36}, \\
P(X=6)=1-\frac{25}{36}=\frac{11}{36} .
\end{array}
$$

Therefore, $\mathrm{E}(X)=1 \times \frac{1}{36}+2 \times \frac{3}{36}+3 \times \frac{5}{36}+$
$$
\begin{array}{l}
4 \times \frac{7}{36}+5 \times \frac{9}{36}+6 \times \frac{11}{36} \\
=\frac{161}{36}=4 \frac{17}{36},
\end{array}
$$

which is closest to $4 \frac{1}{2}$.