1- Was this question an appropriate interview question?
If you're applying for a developing job, then it is pretty appropriate. Not only because it may be a requirement because you work with others, but also it may be a requirement when you leave to also leave a good code base.
Indeed, it could be pretty subjective. To me, it's just to sound you out, to have an idea of what you consider clean code (and thus, the way you might code). However, it may not go the way the interviewer wants:
I once had a colleague whose idea of clean code was "code that can be read fast". Time proved that by "read fast", he meant "written fast", as in "variables with one character names, loops and conditionals without brackets, big utils
files with tons of global variables and functions out of scope".
To me, clean code means the other way around. Self-explanatory variables and methods names, following a standard coding style, trying to split methods in meaningful classes, documenting all the classes, methods and variables so that you can extract a documentation, and also documenting example code on specially important methods.
2- Is this a common question? If so, what would a bad answer to it would look like?
I've been asked directly once, indirectly twice. The indirect ones went pretty well. They were something like:
- What do you want to see in others' code? (as "I expect you do the same")
- Do you enjoy coding? (as "you do fine code pieces")
In both cases, I showed some code (unrelated to previous jobs), and they were glad.
The one that went direct was a little less couraging. After I explained that I did all that, her response was something like:
So, you take more time writing than thinking?
They didn't hire me, luckily!
The rule of thumb: Be honest. If you are a developer, tell the way you do. They might like it or not, but you won't have a surprise afterwards, if you're honest.