6
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 objects 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? A. java.io 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

MX Server is my friend

Embed Size (px)

DESCRIPTION

Company Newsletter for January

Citation preview

Page 1: MX Server is my friend

Multiple Choice

1) What is an abstract function? A. A function that can be overridden in an inheriting classB. A function that has no side-effectsC. 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 structureB. A stack is made up of a linear array of values, while a Queue is made up of a linked list of ob-jectsC. 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? A. java.ioB. java.utilC. 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. PrivateB. ProtectedC. Public

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

A. PrivateB. ProtectedC. Public

Page 2: MX Server is my friend

c) What is the visibility of m_var to a subclass in a different package?

A. PrivateB. ProtectedC. Public

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

A. It is compiler dependentB. 4C. 8D. 64

7) Which keyword is used on a method to indicate that only a single thread at a time should execute the method?

A. volatileB. synchronizedC. transientD. 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); }}

Page 3: MX Server is my friend

A. 4B. 3C. 2D. 1E. 0

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

A. WARB. EARC. JARD. ZIP

10) Which of the following are features of EJB3.0?1. Written as POJOs2. Supports Java Persistence API3. Requires deployment descriptors4. Uses annotations

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

Short AnswerQuestion #1:

Outline the main differences between J2EE and J2SE. Give an example of a type of ap-plication 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?

Page 4: MX Server is my friend

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 be-tween 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 Ex-ample?

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);

}

Page 5: MX Server is my friend

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?