Sapient Interview Question Answer
Sapient Interview Question Answer
Sapient Interview Question Answer
#Today's uploaded
#Sapient #Interview #Questions and# Answers for #Java 2 - 6 Year #Experience
#Sapient #Interview #questions for #Java #experience #candidate - 2 -6 #years.....
Ans � It�s a Map which providing thread safety and atomicity guarantees. For Memory
consistency it works with other concurrent collections, actions in a thread prior
to placing an object into a ConcurrentMap as a key or value happen-before actions
subsequent to the access or removal of that object from the ConcurrentMap in
another thread.
Ans - Basically iterator access process the traverse operation through each
element, where index access process access direct the element by using the index.
Q8) Why character array is better than string for storing password in Java?
Ans � Security !!! Because, character array stores data in encrypted format which
is not readable by human. But, the string stores the data in human readable format
which is not secure.
Ans - Both interfaces are used for implement serialization. But, the basic
difference is Serializable interface does not have any method (it�s a
marker interface ) and Externalizable interface having 2 methods such as
readExternal() and writeExternal(). Serializable interface is the super
interface for Externalizable interface.
Ans �Yes its possible, when that interface is implemented by that class.
Ans � As we know stack memory is not dynamic and its follows LIFO order. Java
provides similar implementation for memory allocation. Normally all local variables
are created in Stack area (memory) and objects (reference types) are created in
heap memory (heap area) .Even all primitive types allocated in stack memory. Heap
area is dynamic and handled by JVM runtime. Heap memory is cleaned by garbage
collector at runtime.
Ans � Usually memory leak leads to waste of memory. In general memory leak defines
the unavailability of referenced memory. It causes the Garbage collector to fail to
collect that object.
Ans � Yes, but you need to mentioned �throws� on the method head.
Example �
try{
interObj.display();
}catch(Exception e){
System.out.println("Exception handled...");
}finally{
throw new Exception("This is exception");
}
}
Ans � Yes, java handles overflows and underflows very intelligently. When it
overflows it will go to MIN_VALUE (i.e. -231 ) and when it underflows to will go to
MAX_VALUE (i.e. 231-1) .
Ans � Casting means conversion. Basically we need casting to type cast the type.
There are two types of casting by java i.e. explicit casting and implicit casting.
Ans � It provides runtime access to JVM. Reflection is one of the most powerful API
which help to work with classes, methods and variables dynamically at runtime.
Basically it inspects the class attributes at runtime. Also we can say it provides
a metadata about the class.
Q22) Describe a problem you faced and how did you solve that?
Ans - You can describe any issue you faced during your project work in the
organization. And what the solution you have implemented for that issue