COSC 3550 - Programming Computer Games
Sample Questions for Exam 2

Write your answers clearly on the separate paper provided.

Do your own work. You may consult the Java API and the course website, but you are not allowed to use email, talk, chatrooms, or any other method of communication during the exam.


Q. The tortoise and the hare are having a race in front of Cudahy. Unfortunately, while the tortoise moves across the background quite nicely, the hare is surrounded by a white box. Here is the Java source for the program. Explain what is wrong with the hare and how we might fix it.

Q. Suppose that we wish to enhance the program in the previous question by adding some sound. In particular, I would like a loud bang to sound at the beginning of the race (for the starter's gun). Explain what changes would need to be made in the Java code to add this sound effect.

Q. Given the following simple game, maneuver the blue box to be inside the hollow red box at the top of the screen. Here is the source code for the game.

Once you get the blue box into the red box, a code will be printed. Write that code down as the answer to this question.

(Hint: Read the program to figure out what to do.)