Final Exam Review Guide

General Information

Where and When

All students (except those that have been pre-approved for an alternate time) will take the final Saturday, May 2, 7:00-10:00 PM.
Location - All students should report to their normal classroom (Gilmer 130, Maury 209, or Olsson 009)
The Review Session is Friday, May 1, 6:00-7:30 PM in Gilmer 130.


All conflicts should have been reported to Prof. Sherriff. If you have not received a response, you should contact Prof. Sherriff directly.

What to bring

You only need a writing utensil - pen or pencil. No laptops, calculators, scratch paper, backpacks, books, or anything else should be brought. These items will be left in the back of the room if you bring them. It is also highly recommended to dress in layers. Some classrooms do not have good A/C after hours.

Test Specifics

We are writing the test to be 1 ½ times the length of the previous two tests. So, we are writing the test to take 1 ½ hours, but you will have all 3 hours.

This test will have considerably more multiple choice questions compared to previous tests. However, there will be many questions that involve reading and evaluating code alongside the typical concept-type questions.

Major things you can expect:

  • A “long” coding question, one that asks you to solve a problem and will encourage you to use the various tools you’ve picked up this semester
  • Reading and evaluating methods / code snipits
  • Some questions related to material from the first two thirds of the class
  • Some questions specifically about the final third of the class
  • No questions about JOptionPane or other topics that were covered only in lab
  • No questions regarding the Image Chase or Professor AMAs

Final Third Major Topics


  • Creating classes
  • Constructor methods - how to create them and why they are important
  • Objects have state and behavior - how does this translate into code
  • Making classes talk to each other (like Department and StudentSchedule do)

Recursion and Algorithms

  • Base Cases - the simplest version of a problem for which you have an answer for
  • Call itself - a recursive method must call itself
  • Change the input - you have to make the method calls approach the base case to terminate
  • Fib sequence
  • Bubble sort vs. Merge sort (idea of algorithms; relative speed; you will not have to code this)
  • Linear search vs. Binary search (idea of algorithms; relative speed; you will not have to code this)

Under the Hood

  • How memory works in Java; the stack and the heap
  • What does it mean for code to be “better?” - speed, easier to read, fewer bugs, quicker to write


  • The concept of a picture and pixel as represented in Java (basically, a 2D array of pixels, where a pixel is a single color point)
  • General complexity of most image algorithms we looked at (n2)
  • General idea of the various image algorithms worked (you will not have to code them; you may have to read them)

Previous Major Topics

The Case for CS

  • Where do we see computing in the world?
  • Why is it important for people to have a basic understanding of computing?

The Parts of a Program

  • Be able to identify the different parts of a program including:
  • import statement
  • public class statement
  • public static void main statement
  • the following special characters: {} for code blocks, () for giving information to methods to use, ; for ending lines, a period for calling a method from an object

Primitive Data Types

  • In general, you should know about the 8 primitive data types and how they are used
  • Most importantly, though, know how the main ones work (int, double, char) since you’ll be coding with them
  • Know how casting works between types (i.e. how we turned a char into an int and back)
  • Review basic math in Java: how things like ++, +=, etc. all work, what integer division does versus double division
  • Test saving values of a different type than the variable you are using - such as what happens when you try to store a double in an int
  • Know some of the important methods in Math that we used, like pow() and sqrt(), and how we called them in the program

Decision Structures

  • Know specifically how if and if-else statements work and how to interpret them
  • Know how the scope of a variable is affected by declaring a variable inside an if statement (or any code block), such as an if statement or a loop
  • Know in general why we should use switch statements in certain circumstances


  • Know the construction of for, while, and do-while loops
  • Know when and how to use each of these types of loops

File I/O

  • Reading CSV files
  • Know how to read lines from a file and how to split a line on a comma into a String array


  • You WILL be asked to write methods on this test
  • Know the parts of the method signature and what each part means/does
  • Know the difference between a void return and a method that returns a data type of some kind (and when you would use each)
  • Know pass by value vs. pass by reference and how each is used
  • Be able to handle method level scope as parameters are passed and used in methods


  • You will be asked to write a class
  • Know what fields and methods are
  • Know what getters/setters are
  • Know why we make fields private and methods public
  • Know how to write default constructors and constructors that take parameters
  • Know how constructors are call, what they do, and why they are important

Arrays / ArrayLists

  • Know how to initialize and use 1D and 2D arrays
  • Know how an ArrayList is different than an array and how you use one

Coding Tips - Your “toolbox”

Throughout the semester, you have been adding to your programming “bag of tools.” There’s not a good way to only ask programming questions specific to one part of what we’ve talked about. You’re going to have to be able to adapt and use different tools together to solve problems. Some tools you should know include (but are not limited to):

To print a literal out to the screen (like asking someone for information):

System.out.print("Please enter a number: ");

To print out a literal concatenated with a variable:

System.out.println("Hi!  My name is " + name + "!");

where name here is a variable that has some information stored in it.

To read in information from the keyboard, first you have to setup/activate/initialize a Scanner:

Scanner keyboard = new Scanner(;

Remember - if you have a red line under Scanner, roll over it and then choose “import java.util.Scanner” from the Quick Fix list!

Now that you have activated the Scanner, use this to actually get what the user is typing:

String name = keyboard.nextLine();  // This is if you are reading TEXT, like a name
int value = keyboard.nextInt();  // This is if you are reading AN INTEGER, called an int in java
double decimalValue = keyboard.nextDouble();  // This is if you are reading A DECIMAL NUMBER, called a double in java

Comparing Strings - To do this, you need to use the .equals function that comes with the String class:

String name = "Mark";
String name2 = "Jose";
boolean sameName = name.equals(name2);

if-else-if statements - This will check each option and have an else statement at the bottom that is the “in case of anything else” option:

if (x > 5)
   System.out.println("x is bigger than 5!");
else if (x > 0)
   System.out.println("x is bigger than 0!");
else if (x > -5)
   System.out.println("X is bigger than -5!");
   System.out.println("x is bigger than.... negative infinity?");

switch statements - Switch statements read in a value and then effectively work like a big if-else statement:

switch (letterGrade) {
   case 'a':
   case 'A':
      System.out.println("Your grade is an A!");
   case 'b':
   case 'B':
      System.out.println("Your grade is a B!");
      System.out.println("Your grade is… something else.");

for loops - for loops are great when you know how many iterations you want the loop to run:

for ( int i = 0; i < someValue; i++ ) {
    // Code here that gets run i times

Note that the for loop has the initialization of i, the test of i, and then the incrementing of i.

while loops - while loops are good when you don’t know how many iterations you need to go, or for input validation

String input = myKeyboard.nextInt();
while ( input != -1 ) {
     // do something with input
     input = myKeyboard.nextInt();  // make sure to read the next int in for the next check!

do-while loops - do-while loops work just like while loops, except you always run the loop once, since you do the check at the end of the loop, and not the beginning

do {
     // do some stuff
} while ( input != -1 );

files and scanners - opening files and reading them with Scanners (maybe even using split() to read a csv)

File myFile = new File("list.csv");
Scanner openedFile = new Scanner(myFile);

methods - you should know how to write a method and what every part of the signature/header line does

public static String reverse(String str)
// public - anyone can use it
// static - can be called without instantiating the class
// String - return type
// reverse - name of method
// String - type for parameter
// str - parameter variable name

arrays and arraylists - knowing how to create an array or arraylist, adding and removing, and looping over all the items is a very very good thing to know

int[] myArray = new int[10];
myArray[0] = 4;
myArray[1] = 3;
ArrayList<Integer> myArray2 = new ArrayList<Integer>();

Things to do to study for the test

No. 1 - Practice your coding without Eclipse!

Let’s be honest - we’ve done a lot of coding in this class so far because that’s really the first step. You’ve got to learn the basics. So, yes, there are going to be coding questions on the test. And, no, you won’t have Eclipse to use!

Are we going to be overly concerned about exact syntax? No, not really, because right now you’re still learning and Eclipse is helping you out a lot. What we’re after is if you’re starting to figure out how to think computationally - can you look at a problem and then figure out what the proper algorithm is to solve that problem using a program.

If it’s really off will we still take off points? Yes, we will, because we still expect you to know that a semicolon comes at the end of each line, etc.

For each coding question, we will most likely give you the class statement and let you write the code inside it. For example, we might give you this:

import java.util.Scanner;

public class Question2 {
     public static void main(String args[]) {


and let you fill in the rest.

How should you practice? is a really great idea. The programming challenges from chapters are good. Reviewing assignments and labs is good.

And always remember: a question with at least some reasonable attempt at an answer is always better than a question that’s left blank!

No. 1a - Reading programs!

Writing programs is good, but reading them and understanding them is good too! Be able to trace through code and know what’s happening as you’re working through it!

No. 2 - Review the lecture notes!

If we talked about it in class, then we think it’s important. If we skipped something in the book, then there’s a very good chance we’re not going to ask about it. We only get a limited amount of time to ask you questions on the test!

No. 3 - Listen to the podcasts!

If there’s a topic that has been really tough for you, go back and re-listen to the lecture!

No. 4 - Review the labs and homework assignments!

Go back and look at the (labs and) homework assignments. I think you’ll get a good idea of what types of questions we like to ask. Labs were intended to reinforce ideas in interesting context, but if an idea showed up in lab and never in homework (such as JOptionPane) we didn’t think it important enough to be worth testing.