|Syntactic Confectionery Delight|
One of my professors was fond of saying that you can't study for a programming (or math) exam. If you don't know it by the night before the exam, no amount of cramming will help.
This may be true, but was of little consolation to those of us worrying about the upcoming test.
I've found that the best way to prepare for a programming test is simply to program. Write as much as you've got time for, run it all through the computer, and learn as much as you can from it. Syntax is a big issue, but it's also good to know all the little quirks of a language.
Write a small program that does nothing but simple file I/O. Write another one that just takes keyboard input. Write one for string manipulation, for math functions, for... whatever you think might trip you up on the test. You've been in the class long enough to have a good grasp of the subject matter. All you need now is the ability to express your knowledge in program form.
One big issue is whether the professor favors Elegance or Openness. I had a professor (same one who claimed you can't study) who was an elegance nut. The more "elegant" (his word for obfuscated) your code, the higher he'd grade you. If you could write a program in a single bewildering line, using constructs from strange nooks and crannies of the language, you'd get a gold star.
Conversely, I had another professor who loved programs that were perhaps less efficient and impressive, but easily understandable. If you turned in a one-liner when he was looking for a half page with comments, he'd mark you down for being a smartass.
Woe be to the student who forgot which class he was in...