  Using Magnetospheric Multiscale (MMS) observations at the Earth's
quasi-parallel bow shock we demonstrate that electrons are heated by two
different mechanisms: a quasi-adiabatic heating process during magnetic field
compression, characterized by the isotropic temperature relation
$T/B=(T_0/B_0)(B_0/B)^{\alpha}$ with $\alpha=2/3$ when the electron heating
function $|\chi_e|<1$, and a stochastic heating process when $|\chi_e|>1$. Both
processes are controlled by the value of the stochastic heating function
$\chi_j = m_j q_j^{-1} B^{-2}\mathrm{div}(\mathbf{E}_\perp)$ for particles with
mass $m_j$ and charge $q_j$ in the electric and magnetic fields $\mathbf{E}$
and $\mathbf{B}$. Test particle simulations are used to show that the
stochastic electron heating and acceleration in the studied shock is
accomplished by waves at frequencies (0.4 - 5) $f_{ce}$ (electron
gyrofrequency) for bulk heating, and waves $f>5\,f_{ce}$ for acceleration of
the tail of the distribution function. Stochastic heating can give rise to
flat-top electron distribution functions, frequently observed near shocks. It
is also shown that obliquely polarized electric fields of electron cyclotron
drift (ECD) and ion acoustic instabilities scatter the electrons into the
parallel direction and keep the isotropy of the electron distribution. The
results reported in this paper may be relevant to electron heating and
acceleration at interplanetary shocks and other astrophysical shocks.
