Final Exam Information

 

 

Time:  Wednesday, May 12, 5:05-7:05pm

Place:  1221 Computer Science

Bring:  Your student ID and some pencils

 

 

What’s the exam format?

 

The format will be the same as before.  It will focus heavily on the last three topics (files, arrays, inheritance) and on the last two assignments.  Almost anything about earlier topics will use them in the context of the new topics.

 

 

How can you prepare?

 

Looking over things we’ve done is a good idea for the true/false and multiple choice questions.  Remember that just looking over things doesn’t help you write code, though.  The only way to prepare for writing code is to practice writing it.  Here are some suggestions for studying:

 

 

 

Terms:

 

token

delimiter

append to a file

flush to a file

file path

array

array index

array entry

array length

initializer list

multi-dimensional array

ragged array

variable-length array

inheritance

superclass

subclass

ancestor class

descendant class

sibling class

unrelated class

member visibility

protected

default constructor

polymorphism

dynamic binding

instanceof operator

method signature

method prototype

overloading

overriding

interface

abstract

implements

extends

 

 

 

1)  Suppose you have the following: 

 

Point[] array = new Point[10];

 

·        What variable types exist here?

 

 

·        Rewrite the code above in several legal ways that have the same effect.

 

 

 

·        Write a line of code that would cause an ArrayOutOfBoundsException.

 

 

·        Write a line of code that would cause a NullPointerException.

 

 

·        Write the value of  this expression:  array.length

 

 

·        Write a method to which you could pass this array to fill it all up, so that the ith point has coordinates (i,i).

 

 

 

 

 

              

2)   Suppose you have the following:

 

               Vehicle wheels = new Truck();

      wheels.drive();

 

 

 

 

 

 

 

 

 

 

 

 

3)  Suppose you have this method:  protected int f() { … }

 

 

protected double f() { … }

        private int f(int x) { … }

   public int f() { … }

 

 

public int f() { … }

private double f(int x) { … }

protected char f() { … }