When does the Amplitude Spectrum equal the Magnitude Spectrum?
You are right that also for the second signal you have $M(\omega)\neq A(\omega)$, but the point here probably is that in the fundamental interval $\omega\in (-\pi,\pi)$ the two are identical. It is only at $\omega=\pm\pi$ that the phase $\phi_M(\omega)$ jumps and that $A(\omega)$ changes its sign. So what they probably mean is

$$M(\omega)=A(\omega)\quad\text{and}\quad\phi_M(\omega)=\phi_A(\omega)\quad\bbox[5px,border:2px solid red]{\text{for }\omega\in(-\pi,\pi)}$$

which is correct (and which is not the case for the first signal).

Remember that such quizzes are made by fallible humans.