Are supervisors required to read their students' work or not; and if not, how do they ensure that the work is correct?
Certainly not the entirety of it, especially for PhD students. By the end of a PhD, the student should be a better expert in their narrow topic than their supervisor. Moreover, in science, we do not repeat every single bit of others' work to be able to judge whether the result is correct or not.
And that is especially true for coding-heavy PhDs of late. My own advisor does not write or read code at all, that does not mean I should not have written any or that I should have forced them to pick up coding just to supervise me. This is just absurd.
Instead, they would have questions (usually) representative of those people in the field would generally have. In some aspects, the roles easily get reversed: advisor-student relationship is not strictly hierarchical, the advisor is not supposed to be better, faster, stronger than the student in every aspect. They are also not supposed to follow the student at every single small step. A PhD student by their graduation should be able to be independent, and they should be able to clearly demonstrate to the thesis committee why their results are correct. The less the advisor's seal of approval matters at that point, the better.
My friend is very frustrated
I would advise approaching it similarly to reviewers' comments. If they did not understand everything you said and are asking "stupid" questions, they are usually in the right. Do not look up to the advisor as some kind of an Übermensch: if they did not understand something, what odds are there that the thesis committee will understand it? It is one's job to communicate their work clearly, not readers' job to thoroughly reexamine every nook and cranny. If I read your paper and you did not convince me that your results are sound, presenting arguments understandable by me, I would likely not even get to open your code. And all the hard work that went into it would not matter at all if you did not bother to answer "stupid" questions or thought it is my responsibility to ascend to your level of understanding to be able to bask in your infinite wisdom. Sorry.
This is not the only approach to advising possible. And there are truly stupid questions. But from your post, I got a different impression: very likely, there is value in what your friend's advisor does. If your friend leans towards offering their work only to a select few who will put enough effort in understanding it, they have gotten it backwards. If they overemphasize the role of their advisor in a PhD (as in, results are only valid iff an advisor says so, they then say so to the committee and the work gets a greenlight), that is also problematic.
So there you have it. There is a big gap between "does not even read the code" and "completely clueless about the experiments, methodology, and results". The former is definitely normal, the latter is not. Some in-betweens are also common (e.g. an advisor might not understand some specific parts of the methodology, and that is also fine).