The consent is you’re given a random question and let’s see how you do under pressure to solve it. What creativity do you have? What can you remember? How do you interact with the interviewer?
Memorizing the question or the patterns commonly used and being able to regurgitate it out doesn’t make you good. You’re lying and breaking the agreed upon consent. You don’t know what you’re doing, you’re just regurgitating out a string answer instead of creating the object oriented program you lead them to believe you have. This puts real programmers who don’t have time to memorize trivial work at a disadvantage.
Programming interviews need to be based on real world situations. If that’s not possible, memorizing a bag of tricks that aren’t useful or practical in the real world is not an acceptable solution.
(How about you do a paired code review instead? You’d see real code, show team work skills, and demonstrate your knowledge by the questions you ask or bugs you flag as potential problems.)