6
Q:

void waitForSignal() {

Object obj = new Object();

synchronized (Thread.currentThread()) {

obj.wait();

obj.notify();

}

}

Which statement is true?

A) This code can throw an InterruptedException. B) This code can throw an IllegalMonitorStateException.
C) This code can throw a TimeoutException after ten minutes D) All the above

Answer:   B) This code can throw an IllegalMonitorStateException.



Explanation:

It will throw  IllegalMonitorStateException.

Subject: Java
Job Role: IT Trainer
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 1573
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 1503
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 6560
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 13046
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 29915
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 1489
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 2233
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 2306