Beruflich Dokumente
Kultur Dokumente
A. Private
B. Protected
C. Public
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
A. It is compiler dependent
B. 4
C. 8
D. 64
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 {
i++;
j--;
if(i/j > 1)
i++;
}
catch(ArithmeticException e) {
System.out.println(0);
}
catch(ArrayIndexOutOfBoundsException e) {
System.out.println(1);
}
catch(Exception e) {
System.out.println(2);
}
finally {
System.out.println(3);
}
System.out.println(4);
}
}
A. 4
B. 3
C. 2
D. 1
E. 0
9) J2EE servlets and jsp files are normally packaged into which type of
archive?
A. WAR
B. EAR
C. JAR
D. ZIP
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
software?
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
used.
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
Example?
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?