The exam is multiple choice and multiple answer. You don't have to write code, per se, but you are exposed to a lot of code samples. The key to passing the exam is to get your brain into thinking like a
Java compiler. You read each question, parse it through the JVM in your brain (how's that for cross-platform compatibility) and answer.
There are lots of great books and mock exams. Browse Javaranch and you'll find all of the essentials.
Cheers,
Jason