\normalfont
The electric flux $\Phi$ through a surface is given by:
\[
\Phi = \int \vec{E} \cdot d\vec{A},
\]
where:
\begin{itemize}
\item $\vec{E}$ is the electric field,
\item $d\vec{A}$ is the area vector perpendicular to the surface.
\end{itemize}
% Option
(a) The flux through the cube:
The electric field varies as $\vec{E} = 500x \, \hat{i}$. Only the two faces of the cube perpendicular to the $x$-axis contribute to the flux. Let the cube extend from $x = 0$ to $x = 0.1 \, \text{m}$.
At $x = 0$: The electric field is:
\[
\vec{E} = 500 \times 0 = 0 \, \text{N/C}.
\]
At $x = 0.1 \, \text{m$:} The electric field is:
\[
\vec{E} = 500 \times 0.1 = 50 \, \text{N/C}.
\]
The area of each face of the cube is:
\[
A = (0.1)^2 = 0.01 \, \text{m}^2.
\]
The flux through the face at $x = 0$ is:
\[
\Phi_1 = \vec{E} \cdot A = 0 \cdot 0.01 = 0 \, \text{Nm}^2/\text{C}.
\]
The flux through the face at $x = 0.1 \, \text{m}$ is:
\[
\Phi_2 = \vec{E} \cdot A = 50 \cdot 0.01 = 0.5 \, \text{Nm}^2/\text{C}.
\]
The net flux through the cube is:
\[
\Phi = \Phi_2 - \Phi_1 = 0.5 - 0 = 0.5 \, \text{Nm}^2/\text{C}.
\]
Thus, the flux passing through the cube is:
\[
\boxed{\Phi = 0.5 \, \text{Nm}^2/\text{C}}.
\]
% Option
(b) The charge within the cube:
Using Gauss's law:
\[
\Phi = \frac{q_{\text{enclosed}}}{\epsilon_0},
\]
where $\epsilon_0 = 8.854 \times 10^{-12} \, \text{C}^2/\text{Nm}^2$ is the permittivity of free space.
Rearrange to find $q_{\text{enclosed}}$:
\[
q_{\text{enclosed}} = \Phi \cdot \epsilon_0.
\]
Substitute the values:
\[
q_{\text{enclosed}} = 0.5 \cdot 8.854 \times 10^{-12} = 4.427 \times 10^{-12} \, \text{C}.
\]
Thus, the charge within the cube is:
\[
\boxed{q_{\text{enclosed}} = 4.43 \times 10^{-12} \, \text{C}}.
\]