I generally hate onsite tests. I always feel like anything that doesn't require interviewer interaction should be done as a prescreening phase before a candidate is brought in. I also believe that there are sufficient ways to ensure that a candidate is actually solving the problem themselves (such as doing it on the fly via screen sharing while speaking, etc.).
Nevertheless, these are quite common, and generally tend to favour folks who are recent college graduates who are used to pen-and-paper tests. My experience is that a longer a developer is out of college, the harder it is for them to write code without API references and an IDE. Handwriting long lines of code (without an ability to erase) is also a problem.
As for what you could be asked: Anything really, ranging from math problems to abstract design questions to writing actual code, though usually under a page. There's really no way to prepare for these differently than for a regular interview since you could be asked to solve the same questions in realtime on a board. In general, after finishing your test, you will be reviewing your solutions with someone.
I would highly recommend bringing a pen you are comfortable using with you. It sounds like nitpicking, but it can make all the difference. You are going to be writing several long pages, anything that can be a distraction (like a pen that forces you to push harder). Also bring a stopwatch that is not your cellphone, and make sure to put your cellphone far away. Many places observe the interviewee to make sure they are not cheating. It's easier to have your iphone far away than to expalin that you were only using it for a watch.