Have you looked at the exam and examdesign classes? I'm using examdesign to typeset both exercises and exams and it allows for randomization with automatic answer key creation (on a subsequent page). It's quite neat, even if not perfect. Cyril