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. ADDRESS | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. By querying the STATUS from the ORDERS table. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. a. Create necessary lzx files( template , object definition and properties ), make config entries and then Build open Laszlo project ( for LOBTools ) so that new promotion type should be displayed in management center. b. Create a new promotion type xsl ( promotion type template ) and then map it to the promotion type. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. http://www.java4s.com/java-servlet-tutorials/difference-between-servletconfig-and-servletcontext-in-java/ | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. In first case the whole loop will terminate as soon as any exception happens in the method calculate ( assuming calculate method is not handling its exception and those are thrown back at the calling method ) In Second case exception will be caught for individual iteration and hence it wont break the loop and will continue for the next iteration. | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. Purchase condition is the condition that must be fulfilled before a promotion is applied and Reward is the benefit that is passed to customer. For Example - If promotion is "Buy 2 Quantity of X, Get Y Free" , Purchase condition is inclusion of 2 qty of X in Cart. Reward in this case would be 1 qty of Y. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. Modularity - First sign of good code is whether it has been segregated into methods and classes appropriately. I dont mind it in excess because I believe that is forward looking strategy as applications tends to expand and eventually become hard to read. Self Explanatory - Variables and methods should be named in a way that the code should be self explanatory even without comments. Use of Constant variables to explain use of literal. Proper Code Reuse - If there is anything being reused , it should be moved to parent classes / methods. Proper composition calls - Composed hierarchy should not be access in just single line. One or two levels is ok but having multiple levels make it hard to read and debug. | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() ![]() | ||||
| ||||
Ans. Abstract classes provide a mechanism of interfacing ( using abstract method ) as well as inheritance ( extending abstract class ). So they should be used in place of interfaces in case there is some code ( methods ) or object body ( member elements ) that can be reused with inheritance. | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. https://www.tutorialspoint.com/javaexamples/thread_procon.htm | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. Heap memory. | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. Because of the life cycle requirement for different type of values in java. variables initialized and used in functions needs to be destructed with the execution of function and hence kept in stack. Same is applicable for the object references initialized within the method. If objects would have been created in stack, they wouldnt have been passed around across methods and hence they are created on heap. So anything that is required beyond the scope of a method or function is kept on heap which is usually garbage collected by Java. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
![]() | ||||
| ||||
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"); } static private volatile SingleTon singleTon; public static SingleTon getInstance() { SingleTon singleTon = this.sample; if (singleTon == null) { synchronized (this) { singleTon = this.singleTon; if (singleTon == null) { singleTon = this.singleton = new SingleTon(); } } } return singleTon; } } | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. Select Name from EMPLOYEE where ID in (Select ManagerEmployeeId from EMPLOYEE Group By ManagerEmployeeId order by count(Id) LIMIT 1) | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. Everytime an object is serialized the java serialization mechanism automatically computes a hash value by passing the meta information for the class. This id is used during deserialization to verify that the sender and receiver of a serialized object have loaded classes for that object that are compatible with respect to serialization | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() ![]() | ||||
| ||||
Ans. Better Control - If the value is being used at multiple locations , that can be controlled better from single place. Any change would only require making single change. Meaning , Aliasing and Better Readability - Sometimes its easy to read the value by its meaning or alias ( 0 as ZERO or 0 as NEUTRAL_VALUE ). | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. static methods and static elements are shared by all objects of a class and hence could create problem. Static methods are not synchronized by default and hence could create problem when accessed through multiple threads. Static elements are shareable by class and hence state of one object could be altered by another object. Some limitations with Unit testing as not all mocking framework facilitate mocking them. Power mock allows but Mockito doesn't | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. Maven is a build automation tool used primarily for Java projects. | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() ![]() | ||||
| ||||
Ans. Spring Boot is Springs convention-over-configuration solution for creating stand-alone, production-grade Spring-based Applications. | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. 500 is Internal Server Error 404 is resource not found 400 is Bad Request 403 is Forbidden 401 is Unauthorized 200 is OK | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() | ||||
| ||||
Ans. int[] arr = {1,-1,2,-3,3,-4,4,5,6,-5,-6,-7,-8,8,9,-9}; List positiveNumbers = new ArrayList<>(); List negativeNumbers = new ArrayList<>(); for(int i = 0; i < arr.length(); i ){ if(I < 0){ negativeNumbers.add(i); } else { positiveNumbers.add(i); } } System.out.println("Positive Numbers:" + positiveNumbers); System.out.println("Negative Numbers:" + negativeNumbers); | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. Collections in java is a framework of classes that provides an abstracted data structure to store and manipulate the group of objects. Each class is unique in the way it stores , search , sort and modify the elements. | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() ![]() | ||||
| ||||
Ans. toString() is an overloaded method of String class that is used to convert many data types to String, Boolean being one of them. toString(Boolean bool) | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() | ||||
| ||||
Ans. It is special literal. It is neither keyword nor identifier. Any reference in java that doesnt point to any object , gets assigned null i.e is a reference to null | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. PID - process identification number is an identification number that is automatically assigned to each process when it is created USER - User Name PR - PR is the process actual priority NI is the nice value, which is a user-space concept. VIRT -Virtual Image (kb). The total amount of virtual memory used by the task. RES - Resident size (kb). The non-swapped physical memory a task has used. SHR - Shared Mem size (kb). The amount of shared memory used by a task. S - Process Status. The status of the task which can be one of: D = uninterruptible sleep R = running S = sleeping T = traced or stopped Z = zombie %CPU - % CPU usage %MEM - % MEM Usage TIME - Total CPU time the task has used since it started. COMMAND - Command which was used to execute the process | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. du -a /var | sort -n -r | head -n 10 | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. 59 23 28-31 * * [ "$(date +%d -d tomorrow)" = "01" ] && job_name | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
![]() | ||||
| ||||
Ans. [Open Ended Answer] | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() | ||||
| ||||
Ans. An Error indicates serious problems that a reasonable application should not try to catch whereas An Exception indicates conditions that a reasonable application might want to catch. | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() ![]() | ||||
| ||||
Ans. <a href="http://javahungry.blogspot.com/2015/03/difference-between-array-and-arraylist-in-java-example.html" rel="nofollow">http://javahungry.blogspot.com/2015/03/difference-between-array-and-arraylist-in-java-example.html</a> | ||||
![]() | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() ![]() | ||||
| ||||
Ans. There is no direct way to make stateful REST service but when first time request send to server, generate the token on server and send back to client. When every time new request is send the token is send to identify the request is coming from same client. | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
![]() ![]() | ||||