0
Q:

public class Threads2 implements Runnable {

public void run() {

System.out.println("run.");

throw new RuntimeException("Problem");

Which among the following is true?

}

public static void main(String[] args) {

Thread t = new Thread(new Threads2());

t.start();

System.out.println("End of method.");

}

}

A) java.lang.RuntimeException: Problem B) run. java.lang.RuntimeException: Problem
C) End of method. java.lang.RuntimeException: Problem D) End of method. run. java.lang.RuntimeException: Problem

Answer:   D) End of method. run. java.lang.RuntimeException: Problem



Explanation:

Only D can be true

Subject: Java
Q:

Explain Overriding Polymorphism.?

Answer

Overriding means changing behavior of methods of base class in derive class by overriding the base class methods. If class A is a base class with method ’calculate’ and class B inherits class A, thus derives method ’calculate’ of class A. The behavior of ’calculate’ in class B can be changed by overriding it.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1465
Q:

When do you use :: Operator in C++?

Answer

:: is the scope resolution operator. When local variable and global variable are having same name, local variable gets the priority. C++ allows flexibility of accessing both the variables through a scope resolution operator

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 1406
Q:

In RDBMS, what is the efficient data structure used in the internal storage representation?

A) Stack B) Queue
C) B+ tree structure D) AVL tree Structure
 
Answer & Explanation Answer: C) B+ tree structure

Explanation:

B+ tree. Because in B+ tree, all the data is stored only in leaf nodes, that makes searching easier. This corresponds to the records that shall be stored in leaf nodes

Report Error

View Answer Report Error Discuss

Filed Under: Java

0 6159
Q:

What are the types of Collision Resolution Techniques and the methods used in each of the type?

Answer

Open addressing (closed hashing),


The methods used include: Overflow block,


 Closed addressing (open hashing)


The methods used include: Linked list, Binary tree…

Report Error

View answer Workspace Report Error Discuss

Subject: Java

16 12736
Q:

main() {

int i;

printf("%d",scanf("%d",&i)); // value 10 is given as input here

}

A) 1 B) 2
C) 3 D) 4
 
Answer & Explanation Answer: A) 1

Explanation:

Scanf returns number of items successfully read and not 1/0. Here 10 is given as input which should have been scanned successfully. So number of items read is 1.

Report Error

View Answer Report Error Discuss

Filed Under: Java

2 20224
Q:

Just by seeing the signature of the bean how can you specity whether it is a Statefull of Stateless Session Bean?

Answer

The create method in a stateless bean cannot have arguments, and can only have a single method called create(). While create in Stateful bean can have arguments and could be any method starting with create string eg. create(arg1, arg2, ...). Although it is not compiler checked but in stateless bean the ejb Passivate() and ejb Active() methods has to be empty as these functions are never called by EJB container. As conceptually in stateful session bean we might need to store the clients information hence arguments in createare necessary. While in stateless bean we don't hence no arguments are necessary. It's intutive isn't intutive isn't. I my life I haven't seen such a futuristic server programming tool as EJB.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

1 1384
Q:

Difference between Java Beans & Servlets?

Answer

java bean is a reusable component, where as the servlet is the java program which extends the server capability. 

Report Error

View answer Workspace Report Error Discuss

Subject: Java

2 2034
Q:

What is Overloading Polymorphism?

Answer

Overloading allows multiple functions to exist with same name but different parameters. Again if you take bike as an example, it has a function “Start” with two forms i.e. ’Auto Start’ and ’kick start’.

Report Error

View answer Workspace Report Error Discuss

Subject: Java

0 2153