Exam Review

The question

A student wrote to me:

I was wondering if you could give me any tips on how/what to study that came to your mind if it isn’t too much trouble.

Everything!

More seriously, if I were you, I’d look over the homeworks + solutions and the quizzes. That’s what I’ll be doing when formulating questions. Expect to see questions you’ve seen before (or more likely, slight variants of them).

What you want, when going over the old stuff, is not to memorize the answers but to understand them. One way to do this is staring at them and rubbing your chin, but it’s likely working with a study buddy will be more fruitful. Ask each other questions, and then make sure you can explain the answer to your pal(s). Your buddy can be a rubber duck if necessary, but a small focused group session might be helpful.

For questions that involve coding, think about what the given solutions does and why — like, what are the cases it deals with? Why are they all necessary? What happens if you omit one or more of them?

Make sure you understand how to write and use generic methods and classes.

For questions that involve, say, linked structures, make sure you can draw out the structures before and after an operation (like, a linked list that backs a stack) and understand why the code to push or pop looks the way it does. For array-based structures, understand how the index into the array helps create the abstraction (for example, how the top index in an array-backed stack works). It would be wise to know how to write these methods.

For things like graph and search, understand the basic terminology and operations.

Minimally you should know how to write a simple test case (a la the “smoke tests”), which is just a method with the @Test decorator that uses the assertEquals (or similar) method to check that another method behaves as it should.

Understand recursion enough to identify the base and recursive case in a recursive method, and whether a recursive method is correctly implemented (and thus will terminate) or not.

Yes, but what are you going to ask on the exam?

Do not ask me to post a sample exam with answers! Not gonna do it.

Questions may ask you to do the following:

  • Determine what a mystery method does, similar to the questions from Quiz 1.
  • Find semantic error(s) in a method, similar to the questions from Quiz 1.
  • Write a method that traverses a linear data structure and computes some property of that structure, similar to the questions from Quiz 1 and various homeworks.
  • Write a generic method that modifies a simple data structure (like a list) in a particular way, similar to Quiz 2 and various homeworks.
  • Extend an existing generic class with a generic method, similar to Quiz 3 and various homeworks.
  • Determine the worst-case running time of Java API methods and a given arbitrary method.
  • Write a generic method that modifies a less simple data structure (like a multimap) in a particular way, similar to Quiz 4 and various homeworks.
  • Determine the result of arbitrary sequences of stack and queue operations, similar to Quizzes 4 and 5.
  • Determine the order nodes are visited during an BFS or DFS, similar to Quiz 4 and various homeworks.
  • Write methods to implement functionality in array- or linked-list-backed stacks and queues.
  • Write unit tests on arbitrary methods, given a description of the behavior of those methods and the desired test.
  • Identify the base and recursive case of recursive methods; determine if the method will terminate.