Sie sind auf Seite 1von 5

Multiple Choice

1) What is an abstract function?

A. A function that can be overridden in an inheriting class
B. A function that has no side-effects
C. A function with no implementation that must be overridden by inheriting classes

2) What is the difference between Stack and Queue?

A. A stack is a Last In First Out (LIFO) data structure, while a Queue is a First In First Out (FIFO)
data structure
B. A stack is made up of a linear array of values, while a Queue is made up of a linked list of
C. They are the same, except that a stack can be larger

3) What does the final declaration mean for a class?

A. It cannot be directly instantiated.
B. It cannot be subclassed.
C. It cannot have a superclass.

4) Which package is implicitly imported for all java classes?

B. java.util
C. java.lang

5) For the definition:

public class someclass

int m_var;

a) What is the visibility of m_var to another class in the same package?

A. Private
B. Protected
C. Public

b) What is the visibility of m_var to another class in a different package?

A. Private
B. Protected
C. Public
c) What is the visibility of m_var to a subclass in a different package?

A. Private
B. Protected
C. Public

6) How many bytes are used by a Java long primitive?

A. It is compiler dependent
B. 4
C. 8
D. 64

7) Which keyword is used on a method to indicate that only a single thread at

a time should execute the method?

A. volatile
B. synchronized
C. transient
D. static

8) Consider the code below. Select the answers that correspond to the
output of running this class.
public class test {
public static void main(String args[]) {
int i=1, j=1;
try {
if(i/j > 1)
catch(ArithmeticException e) {
catch(ArrayIndexOutOfBoundsException e) {
catch(Exception e) {
finally {
A. 4
B. 3
C. 2
D. 1
E. 0

9) J2EE servlets and jsp files are normally packaged into which type of

10) Which of the following are features of EJB3.0?

1. Written as POJOs
2. Supports Java Persistence API
3. Requires deployment descriptors
4. Uses annotations

A. 1,2 and 3
B. 1,2 and 4
C. All of the above

Short Answer
Question #1:

Outline the main differences between J2EE and J2SE. Give an example of a type of
application where J2EE would be used.

Question #2:

Describe the use of a particular design pattern in a previous project. Do you feel that a
"pattern oriented" design philosophy is useful? Does the use of patterns result in better
Question #3:

Explain the purpose of using interfaces in java. Show a simple example that
makes use of an interface.

Question #4:

Briefly describe java reflection and what it is used for. Also, explain the difference
between this and how EJBs are used.

Question #5:

Explain the difference between local and remote interfaces and when each would be

Question #6:
Explain why we cannot declare a constructor as final?

Question #7:
What is the difference between == and equals() ?

Question #8:
Java has a garbage collector so why would you need the finalize() method for? Any

Question #9:
What is wrong with the following code. What would be a way to fix it?

class A {
static Vector quad[][];
public A(){
int row =50;
int col = 100;
Vector quad[][] = new Vector[row][col];
for ( int i =0; i < row; i++ )
for ( int j =0; j < row; j++ )
quad[i][j] = new Vector(0,1);
public int size(){
return quad.length;

Question #10:
A server generates weather forecast maps, a cache is implemented so maps are not re-
generated for the same region, the cache uses the local file system to store the maps ?
What could be the issue if the application is deployed on a cluster of machines? What
solution could you suggest?

Question #11:
Describe your techniques for prevent bugs when writing code?