The point of coding questions is to determine how well you can code. It’s the most important part of the interview because the code you write and the answers you give to the interviewer largely determine whether he recommends you for the job.
You usually work one-on-one with your interviewer. He will give you a marker and a whiteboard (or pen and paper) and ask you to write some code. The interviewer usually wants you to talk through the question before you start writing. Generally, you are asked to code a function or method, but sometimes you need to write a class definition or a sequence of related code modules. In any case, you write code, either in an actual programming language or in some form of pseudo-code. (The closer you can get to actual working code, the better.)
The problems the interviewers give you have specific requirements. They must be short enough to be explained and solved reasonably quickly, yet complex enough that not everyone can solve them. Therefore, it’s unlikely that you’ll be asked any real-world problems. Almost any worthy real-world problem would take too long to explain, let alone solve. That isn’t an option in an interview. Instead, many of these problems require algorithmic tricks or uncommonly used features of a language.
The problems often prohibit you from using the most-common way to do something or from using the ideal data structure. For example, you might be given a problem such as this: “Write a function ...