I think getting the correct answer in code is easier than solving the "trick question" about 3:15.
If I were the interviewer here, I would make sure the candidate states their assumptions and that the code they wrote follows those assumptions. You can make the hour hand stick right at the number for the entire hour, or you can have it smoothly sweep as the minutes (or seconds) increase. I would not care and consider both to be reasonable interpretations (but I've never seen a clock that sticks at the hours; it is harder to implement in hardware).
I honestly wouldn't even ask this question because it's too simple. It's two divisions, a subtraction, and then a modulo 360. It is awkward when your interview question only takes 5 minutes and you have to awkwardly fill 55 minutes with follow up questions ("and how would you test that?").
If I were the interviewer here, I would make sure the candidate states their assumptions and that the code they wrote follows those assumptions. You can make the hour hand stick right at the number for the entire hour, or you can have it smoothly sweep as the minutes (or seconds) increase. I would not care and consider both to be reasonable interpretations (but I've never seen a clock that sticks at the hours; it is harder to implement in hardware).
I honestly wouldn't even ask this question because it's too simple. It's two divisions, a subtraction, and then a modulo 360. It is awkward when your interview question only takes 5 minutes and you have to awkwardly fill 55 minutes with follow up questions ("and how would you test that?").