Out of nowhere, after I thought the interview was over, one guy kept drilling me on that type of low level stuff that had nothing to do with the job just to prove how smart he was. I remembered all of it thanks to a decade of dealing with it and too much time on comp.lang.c but it was still off putting.
I’ve since cut all of that stuff off my resume.
If I'm already 100% sure I'll recommend a hire, it's not rare for me to go off-script and dig into random stuff in the candidate's experience, first of all because I find it interesting or fun to talk about, and second because having deep knowledge about anything is positive signal, regardless of whether it's useful for the job.
I have definitely been in this scenario and asked people who had relevant background to work out low-level performance details of their code. I hope they didn't think I was "drilling" them.
I think he asked me something about the difference between undefined and implementation defined behavior and the an example of each. This was in 2015. I had the same question when it was relevant for an interview in 1999.
I’ve geeked out with another hiring manager at an interview about some old 8 bit coding I did but that felt different.
The last thing I would want to see is lines of code on a whiteboard. I'd want to see how they'd structure their code, not whether or not they remember C/C++/Rust/language-de-jour syntax.
All of the proposals for questions that I've seen in this thread are for basic programming skills. Not whether or not the person knows the environment we are hiring for.
Best to be prepared.
It is common for embedded software engineers to come from electrical engineering, and they are maybe less likely to ask CS-type questions.