Search Interview Questions | ![]() ![]() Click here and help us by providing the answer. ![]() Click Correct / Improve and please let us know. |
|
| ||||
Interview Questions and Answers - Order By Rating | ||||
![]() ![]() | ||||
| ||||
Ans. We can send it but it's completely ignored by the server. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. No, we can also send an empty body with the POST Request. | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. It depends on whether the request object is persisted as it is or its first dismantled, modified or refactored and then inserted into DB. In first case, it should be a PUT request whereas in second case it should be a POST Request. | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() ![]() | ||||
| ||||
Ans. It should be a POST Request | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
![]() | ||||
| ||||
Ans. PUT requests are only meant to place the object as it is on server. For example - You want a file to be uploaded and then placed in a particular folder or you want an Employee object to be persisted in the table. POST requests are also meant to transfer information from client to server but that information once received at the server is evaluated , modified or refactored before persisting. | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() | ||||
| ||||
Ans. Copy Constructor is used for creating a duplicate of another object. Duplicate object will have the same state of the copied object but will have independent values in different memory locations. Copy Constructor can be useful to create duplicates of immutable objects as the Original cannot be tampered. Moreover It can be useful if base copies are required for individual requests in threading. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. A publisher is part of build process that reports whether the build is stable or not. For example - Junit Test report publisher. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. Default methods results in multiple inheritance of behavior and not of state. In case we try to implement multiple interfaces with default method having same name and signature, and don't override it in implementation class, it will throw an error. For example - interface MyInterface { public void default myMethod(){ } } interface MyInterface2 { public void default myMethod(){ } } class MyClass implements MyInterface,MyInterface2 { } This code will compilation error "Duplicate Default Method" if we specify the definition of myMethod() in myClass, compiler won't complain and there is no conflict and MyClass can use overridden definition. But if we don't override myMethod() in MyClass, Java would be in conflict as to what definition should be carried to MyClass and hence throws compilation error. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. No, Main method is the entry point into an application. An application usually contain multiple classes to perform a function. Lets take an example of a House, House usually have only one external Door and you may have internal doors to move around within a house. Internal Doors are methods of classes whereas External Door is a special method called main method. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. 1. Regulation / Enforcement / Policy / Contract , It's primary use 2. Use as a collection of utility methods(since java 8 through default methods) 3. Collecting constants together, As Interface are lighter, it makes sense to use them instead of classes if no getters and setters required. 4. Creation of Custom Annotations 5. Special services like marker interface | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. Slaves are computers that are set up to build projects for a master. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. A build is considered stable if it was built successfully and no publisher reports it as unstable. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. Upstream project is a project whose successful build is required for executing the existing project build whereas Downstream project is the one that is waiting for the upstream project to build as it has the upstream project as dependency. For example - X project has an upstream project y and downstream project Z. So It means X has dependency Y and is a dependency for Z. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. Broken Build means as unsuccessful build whereas unstable build means build was created successfully but one of the Post Build report failed or could be a Test failure. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. Yes, It's an instance initialization block. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
![]() | ||||
| ||||
Ans. Constructor has the same name as class name whereas instance initialization block just have a body without any name or visibility type. instance initialization blocks are useful if we want to have some code run regardless of which constructor is used or if we want to do some instance initialization for anonymous classes. | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
![]() | ||||
| ||||
Ans. Instance Initializer block is used to initialize the instance data member. It run each time when object of the class is created. | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. It is a class level variable that is shared among the objects of that class. | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() ![]() | ||||
![]() | ||||
| ||||
Ans. print method prints the argument passed to the method whereas println prints the argument and then prints the new line character. println is generally used if we want each output in a new line. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. No, It requires creation of atleast one Class. Creating an object of that class is not compulsory as we can write all our logic within main method which is static. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. Earlier any class implementing an interface was supposed to implement all methods declared in an interface. There was no place for optionally implementing all or subset of methods.Though we have abstract classes wherein we could have provided such a mechanism by declaring some methods as abstract while providing definition for some. But as Abstract classes have a body and are comparatively heavier than interfaces and interfaces associate closely to the concept of providing interfacing than abstract classes, Java might have though of providing optional implementation for default methods. This way same interface can be reused in variety of ways rather than making copies of an interface to suit different needs. | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. When a DML is executed, the changes only stays in session and still not pushed to DB Tables, Commit is used to push those changes to the Tables. In case we realize that we don't want to commit those changes and would like to ignore them, we can use rollback. For example - You may like that for a banking transaction you would like to update the account balance only if the debit or credit record was correctly inserted, so you may like to encapsulate both DML's - insert for transaction and update for balance in a single transaction and would only commit if both succeeds else rollback. | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() | ||||
| ||||
Ans. Audit Tables generally stores Raw information to be reviewed in case of problems or determining impact. If Database space is an issue , and the audit information is rarely retrieved, one design could be to use compressed file system. | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
![]() | ||||
| ||||
Ans. Anti-pattern is simply the creation of a pattern in your coding that negatively affects your code i.e the Negatives surpasses the positives. | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() | ||||
| ||||
Ans. This error can result either on an insert, update or delete when any change in data results in duplicate record or subset of it having unique constraint on record or its subset. For example - If we have a unique constraint on a combination of columns and then trying to insert duplicate column values. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. This error most likely will be thrown during an insert statement, while inserting a value within a foreign key column which doesnt exist within the Parent column. For example - Trying to add a dept number reference within a Employee Table when the Dept doesnt exist in the Dept Table. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. HashTable has been deprecated. As an alternative, ConcurrentHashMap has been provided. It uses multiple buckets to store data and hence much better performance than HashTable. Moreover, there is already a raw type HashMap. The only difference between the HashTable and HashMap is that Hashtable is synchronized whereas HashMap is not. Most of the synchronized collections have been deprecated and their raw alternative have been presented as preferred.Synchronization has a cost. Using synchronized collection in places where there is no need of it leads to useless utilization of resources. As these collections are rarely used in a static context or shared among threads, Java might have thought it better to just provide the raw collection and let developers implement synchronization if he feels the need to do so. HashMap is now presented as the default and the preferred way of using Map with read optimized hashing, and ConcurrentHashMap has been provided for synchronized access which provides better performance than HashTable. Because of this, Java thought it right to deprecate the use of HashTable.' Synchronization has a cost. Using synchronized collection at a place where there is hardly any need of it would means useless utilization of resources. As these collections are rarely used in static context or shared among threads, Java might have thought it better to just provide the raw collection and let developer implement synchronization if he feels the need to do so. As HashMap has been presented as default and preferred way of using Map with read optimized hashing, and ConcurrentHashMap has been provided for synchronized access which provides better performance than HashTable, Java thought it right to deprecate the use of HashTable. | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
![]() | ||||
| ||||
Ans. When a Table Join itself , it's a Self Join. For example - we like to know the pair of department names where first dept has lesser employees than the later. Select D1.name , D2.name from Dept D1, Dept D2 where D1.employee_count < D2.employee_count | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() ![]() | ||||
| ||||
Ans. In first case we are trying to initialize Inner class object using the instance of Outer Class whereas in second case we are trying to initialize the Inner class object directly using the Outer class name. In second case , Inner class is "static inner class" as we cannot access "non static inner class" using Classname alone. In first case, the inner class could be either "static inner class" or "non static inner class". | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. Multi Level Inheritance is multi level hierarchy of classes. Here is the example - http://www.buggybread.com/2015/09/java-se-class-diagram-classes-that_603.html Class RoleList extends ArrayList which in turn extends AbstractList which in turn extends AbstractCollection. | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() | ||||
![]() | ||||
![]() ![]() | ||||