More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know.
Interview Questions and Answers for 'Epam' - 38 question(s) found - Order By Newest
Very frequently asked. Among first few questions in almost all interviews. Among Top 5 frequently asked questions. Frequently asked in Indian service companies (HCL,TCS,Infosys,Capgemini etc based on multiple feedback ) and Epam Systems
Ans. "equals" is the method of object class which is supposed to be overridden to check object equality, whereas "==" operator evaluate to see if the object handlers on the left and right are pointing to the same object in memory.
x.equals(y) means the references x and y are holding objects that are equal. x==y means that the references x and y have same object.
Sample code:
String x = new String("str");
String y = new String("str");
System.out.println(x == y); // prints false
System.out.println(x.equals(y)); // prints true
Ans. Composition - has-a relationship between objects.
Inheritance - is-a relationship between classes.
Composition - Composing object holds a reference to composed objects and hence relationship is loosely bound.
Inheritance - Derived object carries the base class definition in itself and hence its tightly bound.
Composition - Used in Dependency Injection
Inheritance - Used in Runtime Polymorphism
Composition - Single class objects can be composed within multiple classes.
Inheritance - Single class can only inherit 1 Class.
Composition - Its the relationship between objects.
Inheritance - Its the relationship between classes.
Ans. final - constant variable, objects cannot be de-referenced, restricting method overriding, restricting class sub classing.
finally - handles exception. The finally block is optional and provides a mechanism to clean up regardless of what happens within the try block. Use the finally block to close files or to release other system resources like database connections, statements etc.
finalize() - method helps in garbage collection. A method that is invoked before an object is discarded by the garbage collector, allowing it to clean up its state.
Ans. Inner join is the intersection of two tables on the condition defined by the where clause i.e will get records from both tables matched by a column.
Outer join is the union of two tables i.e will get all records from both tables and will put null in the columns where related records are not present.
Left Outer join is the left union of two tables i.e all records from the table on the left and values from the right table for related records else null for the columns from right table.
Right Outer join is the right union of two tables i.e all records from the table on the right and values from the left table for related records else null for the columns from left table.
Help us improve. Please let us know the company, where you were asked this question :
Ans. 1. Static class is a class which cannot be instantiated and all its members are static whereas Singleton is the class that only permit creation of single object and then the object is reused.
2. As there is no object in Static class, it cannot participate in runtime Polymorphism.
3. As Static class doesnt allow creating objects and hence it cannot be serialized.
4. Static class body is initialized eagerly at application load time whereas Singleton object can be initiated eagerly using static blocks or lazily on first need.
5. Its not recommended to use pure static class as it fails to use many OOPs concepts.
Help us improve. Please let us know the company, where you were asked this question :
Ans. REST or Representational State Transfer is a flexible architecture style for creating web services that recommends the following guidelines -
1. http for client server communication,
2. XML / JSON as formatiing language ,
3. Simple URI as address for the services and,
4. stateless communication.
Help us improve. Please let us know the company, where you were asked this question :
Ans. throw is used to re throw an exception.throws is used to declare that the method throws the respective exceptions.try block is used to identify if the respective block has thrown any exception.catch is used to catch the exception that has been thrown by the respective try block.
Help us improve. Please let us know the company, where you were asked this question :
Ans. Coupling is the degree of interdependence between software modules, a measure of how closely connected two modules are or the strength of the relationships between modules.
Cohesion refers to the degree to which the elements of a module belong together. Cohesion measures the strength of relationship between pieces of functionality within a given module.
Help us improve. Please let us know the company, where you were asked this question :
Singleton is used when we would like to reuse an object if object is not supposed to hold request or thread specific information. Inversely Prototype is used in situations where we would like to reuse the object information but the request / thread may require it own data to be persisted.
In short, Singleton is used in situations where we can live with single object being shared across multiple requests or threads whereas Prototype is used when we need duplicate copies of objects.
Help us improve. Please let us know the company, where you were asked this question :
Ans. static keyword is used to specify that the respective programming construct ( method , variable ) belongs to the class and not to its instance and is supposed to be shared by all instances of the class.
Help us improve. Please let us know the company, where you were asked this question :
Ans. A List is an child interface of collection interface in java where as Linked list is and implementation class of List interface which has doubly linked as a underlying data structure
Help us improve. Please let us know the company, where you were asked this question :
Very frequently asked. Usually followed by questions related to private constructor and synchronized access. Frequently asked in JPMorgan and TCS (Based on 2 feedback)
This is a very sensitive question and should be dealt with caution. Just simply saying that you never had any disagreement will present you as dumb team member. Showing your self as too aggressive in such decisions will present you as a trouble maker. You should present a situation where you had an argument / disagreement but eventually you and your team mates mutually found a way out of it.
Help us improve. Please let us know the company, where you were asked this question :
Ans. public class SingleTon {
private SingleTon() {
if (singleTon != null) {
throw new RuntimeException("cant not create the object");
}
}
public Object clone() throws CloneNotSupportedException {
throw new CloneNotSupportedException("can not be create");
}
Ans. Factory Design Patterns is the pattern that recommends creation of separate Factory Object for creation of other object.
So its like saying - If you want to create an object of ClassA, Talk to FactoryObject ( which is an object of FactoryClass ). FactoryObject in itself encapsulates the inputs and logic required to make the decision regarding the creation and construction of object.
Help us improve. Please let us know the company, where you were asked this question :
1.Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer,
2.If two objects are equal according to the equals(Object) method, then calling the hashCode method on each of the two objects must produce the same integer result.
3.It is not required that if two objects are unequal according to the equals(java.lang.Object) method, then calling the hashCode method on each of the two objects must produce distinct integer results.
Help us improve. Please let us know the company, where you were asked this question :