CS102 Midterm Review

The CS102 midterm exam will be held on Tuesday, February 23 from 10:00 to 11:30 in McDonnell 162. The exam is covers material through Thursday, February 18 and counts as 20% of the course grade. The following summary of the exam coverage may be helpful as you prepare.

Please remember to read the exam directions carefully. There may be a guessing penalty on some questions.

Definitions (15 points)
You will given terms and asked to supply definitions, or will be given definitions and asked to supply the terms. Be sure you know the definitions of the following terms. The CS102 Glossary contains definitions for these.

Packages and Protection (20 points)
This section of the exam will cover issues related to protection and application programmer interfaces. You will be given an English description of a package, followed by some code for portions of the package in which the protection modifiers have been omitted. Your job will be to decide the appropriate protection modifiers: public, protected, default, or private for selected variables, classes, and methods. You may also be asked to justify your decisions.

The Java Event Model and Inner Classes (20 points)
You will be given user interface code and asked questions about how events are handled during its execution. The code will include some inner classes. You may be asked to add some code of your own.

Exception Handling (20 points)
You will be given some code that is prepared to handle certain kinds of exceptions, and you will be asked some questions about the code and its execution on various input values. You may be asked to add some code of your own.

Concurrent Threads and Deadlock (20 points)
You will be given some code in which a deadlock situation can occur. Your job is to prove that deadlock can occur by describing a possible interleaving of two threads that results in deadlock, and to provide the corresponding resource allocation graph. You may also be asked to show how to fix the code so deadlock can't occur, and to explain why your solution will prevent deadlock from occurring.