We are given the second-order differential equation:
\[
\frac{d^2 y}{dx^2} + y = g(x),
\]
and the initial conditions \( y(0) = 0 \), \( y'(0) = 1 \).
To solve this, we first solve the homogeneous equation \( \frac{d^2 y}{dx^2} + y = 0 \). The general solution to this homogeneous equation is:
\[
y_h(x) = A \sin x + B \cos x,
\]
where \( A \) and \( B \) are constants to be determined by initial conditions.
Next, we find a particular solution to the non-homogeneous equation. Using the method of undetermined coefficients or variation of parameters, we can propose that the particular solution has the form:
\[
y_p(x) = \int_0^x \sin(x - t) g(t) \, dt.
\]
Thus, the complete solution is:
\[
y(x) = \sin x + \int_0^x \sin(x - t) g(t) \, dt.
\]
Now, applying the initial conditions:
- \( y(0) = 0 \) gives the value of the constant \( B \).
- \( y'(0) = 1 \) gives the value of the constant \( A \).
Therefore, the correct solution is option (B).