Step 1: Write the efficiency formula of Carnot engine.
Efficiency of a Carnot engine is
\[
\eta=1-\frac{T_C}{T_H}
\]
Given,
\[
T_H=400\,\text{K}
\]
\[
T_C=300\,\text{K}
\]
Thus,
\[
\eta=1-\frac{300}{400}
\]
\[
\eta=1-\frac{3}{4}
\]
\[
\eta=\frac{1}{4}
\]
Step 2: Use the relation between efficiency and work done.
Efficiency is also given by
\[
\eta=\frac{W}{Q_H}
\]
Given,
\[
W=400\,\text{J}
\]
Therefore,
\[
\frac{1}{4}=\frac{400}{Q_H}
\]
\[
Q_H=1600\,\text{J}
\]
Step 3: Find the heat rejected.
Heat exhausted by the engine is
\[
Q_C=Q_H-W
\]
\[
Q_C=1600-400
\]
\[
Q_C=1200\,\text{J}
\]
Step 4: Final conclusion.
Hence, the energy exhausted by the engine is
\[
\boxed{1200\,\text{J}}
\]