There is a clever trick for that: a classic bash fork bomb will completely die once it gets impossible to spawn new processes. And an easy way to achieve this is to exhaust all PIDs, usually there are 32768 available. So starting enough `sleep` processes will do the job. That is of course if you still can run at least one shell command on the machine.
Other than that the question is stupid, and most companies have a policy that forbids such questions. Same goes for "piano tuners in Manhattan" and "why are manholes round".
From my experience there are three reasons these questions are asked:
1. To see what your thought process would be in figuring out the answer.
2. To judge your reaction to such a nonsensical question.
3. To show off (either the interviewer is showing off or the company is showing off).
That said, they have some value depending on the position your being interviewed for.
Other than that the question is stupid, and most companies have a policy that forbids such questions. Same goes for "piano tuners in Manhattan" and "why are manholes round".