\n"); } else { header("Content-type: text/html; charset=utf-8"); } ?> CS-343 Exam Archive "Spring", "09" => "Fall"); $EXAMS_PER_SEMESTER = 3; $num_exams = $EXAMS_PER_SEMESTER; $current_term = ""; // php generate_link() // ------------------------------------------------------------ /* Generates date text from a file name in the form * yyyy-mm_Exam_#.pdf. Also generates tr, th, and td tags. */ function generate_link(&$value, $key) { GLOBAL $terms, $EXAMS_PER_SEMESTER, $num_exams, $current_term; $parts = explode("_", $value); $semester_parts = explode("-", $parts[0]); $year = $semester_parts[0]; $semester = $terms[$semester_parts[1]]; $exam_parts = explode(".", $parts[2]); $which_exam = $parts[1] . "_" . $exam_parts[0]; if ($parts[0] != $current_term) { while ($num_exams < $EXAMS_PER_SEMESTER) { // Fill out row. print " \n"; $num_exams++; } $num_exams = 0; print " \n \n"; print " $semester, $year\n"; $current_term = $parts[0]; } echo "$which_exam\n"; $num_exams++; } ?>

This is an archive of past exams I have given in this course. I provide this archive for two reasons: (1) Some people have copies of old exams anyway, so it seems only fair for everyone in the class to have the same material available to them. (2) Seeing old exams gives you some idea of what kinds of questions I ask on exams. That is, you can see my personal “exam style.”

A Note of Caution: Do not try to use these exams as a study guide for this semester’s exams. If you look over the old exams you will see that I do not ask the same questions each time. The facts are: I don’t cover the same material each semester, I don’t assign the same projects each semester, and I don’t even use the same textbook each semester. So trying to learn the answers to past exam questions is a very poor strategy for preparing for this semester’s exams. A much better strategy is to study the reading assignments carefully and spend as much time as it takes to work through the assignments and be sure you understand them fully. For these reasons, I do not provide the answers to past exams.

When students ignore this advice, the consequences are generally quite grim!

PDF All documents are in PDF format.

There are no exams in the archive!"; } else { // Put files in reverse chronological order rsort($files); // Put exams for each semester in chronological order. $all_exams = array(); $current_semester_str = ""; $current_semester_exams = array(); foreach ($files as $this_exam) { $this_semester_str = substr($this_exam, 0, 7); if ($this_semester_str != $current_semester_str) { while ($current_semester_exams && count($current_semester_exams) > 0) { $all_exams[] = array_pop($current_semester_exams); } $current_semester_str = $this_semester_str; $current_semester_exams = array($this_exam); } else { $current_semester_exams[] = $this_exam; } } // Pick up earliest semester while ($current_semester_exams && count($current_semester_exams) > 0) { $all_exams[] = array_pop($current_semester_exams); } reset($all_exams); print " \n"; print " \n"; print " "; array_walk($all_exams, "generate_link"); print " \n"; print "
SemesterExams
\n"; } ?>