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 Newest | ||||
![]() ![]() | ||||
| ||||
Ans. It make sense if its returning something. It doesnt make sense for void methods where return statement is not preceded by anything. In case of void methods , return as last statement has no impact and is actually a overhead. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. session.createCriteria(Employee.class).add( Restrictions.or(Restrictions.like("name", "A%"),Restrictions.like("name", "B%"))).list(); | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. Maven Module has a Parent whereas Project doesnt. when we add the parent section to the pom file, it adds the module section to the parent project pom file. When we execute mvn compile / install, it basically checks that module section of the parent to identify all the modules that needs to be compiled first. | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. It means that the respective folder is not looked upon by Java to look for java or resource files and hence not being included as part of build.It needs to be added to Java Build Path. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. .project is a project description file that helps plugins and eclipse understand about the project - organization of projects , their names, builders used by them etc. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. .classpath specifies the source java and resource folders that are used by Builders to build. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. Shutdown hook is a thread that is invoked implicitly by JVM just before the shut down. It is used to clean up unused resources. | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. No we cannot start the same thread twice. Each thread has a lifecycle. But Yes, we can run the same code in parallel using different threads. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
| ||||
Ans. Please not that all such questions can be easily answered through recursion. Simple recursive implementation could be traverse(root); void traverse(Element element){ if(element.hasNext()){ traverse(element.next()); } else { System.out.println(element); } } but this algo / code lead to endless loop if there is a loop in graph traversal. So you can keep a collection to keep track of which elements have laready been traversed static List<Elements> listOfAlreadyTraversedElements = new ArrayList<Elements>(); main(){ traverse(root); } void traverse(Element element){ if(element.hasNext()){ traverse(element.next()); } else { listOfAlreadyTraversedElements.add(element); System.out.println(element); } } | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() | ||||
| ||||
Ans. String class is immutable as well as final. Because of these properties , String objects offer many benefits 1. String Pool - When a string is created and if it exists in the pool, the reference of the existing string will be returned instead of creating a new object. If string is not immutable, changing the string with one reference will lead to the wrong value for the other references. Example - String str1 = "String1"; String str2 = "String1"; // It doesnt create a new String and rather reuses the string literal from pool // Now both str1 and str2 pointing to same string object in pool, changing str1 will change it for str2 too 2. To Cache its Hashcode - If string is not immutable, One can change its hashcode and hence its not fit to be cached. 3. Security - String is widely used as parameter for many java classes, e.g. network connection, opening files, etc. Making it mutable might possess threats due to interception by the other code segment. | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. https://en.wikipedia.org/wiki/Agile_software_development | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() | ||||
| ||||
Ans. JDBC is a standard Java Api for Database communication whereas Hibernate is an ORM framework that uses JDBC to connect with Database. Hibernate is another layer of object table mapping over JDBC that provide a database independent, object oriented and an efficient way of database communication. | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. Yes, that can be done using Power Mock. Mockito doesnt provide a way to mock static methods. | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
![]() | ||||
| ||||
Ans. In Java JVM memory settings is done by use the arguments -Xms -Xmx. Use M or G after the numbers for indicating Megs and Gigs of bytes respectively. -Xms indicates the minimum and -Xmx the maximum. | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() | ||||
| ||||
Ans. https://www.mongodb.com/scale/nosql-vs-relational-databases | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() | ||||
| ||||
Ans. Load the file in chunks and then process. If we need to do analytic, we can process analytic information for those chunks and then reprocess the processed information from each chunk. For example - we need to average all marks in the file. We can divide the file and load into 5 chunks and calculate average for each chunk. Then we can collect averages for all 5 chunks and then calculate the final average. | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. A Web service is a service offered by one system to another, for communication over web through http. XML are JSON are usually used for sending across information from one system to another. | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() ![]() | ||||
| ||||
Ans. http://www.w3schools.com/jquery/event_delegate.asp | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. https encrypts the data using SSL whereas http sends it as plain text, So https is secure protocol whereas http is not. Moreover https connects on port 443, while HTTP is on port 80 | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() | ||||
| ||||
Ans. https://www.programcreek.com/2013/03/leetcode-lru-cache-java/ | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. https://www.geeksforgeeks.org/flatten-a-binary-tree-into-linked-list/ | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. DELETE FROM TABLE WHERE ROW_NUM NOT IN ( SELECT MAX(ROW_ID) FROM TABLE GROUP BY DUPLICATE_FIELD ) | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. public static Stream permutations(String str) { if (str.isEmpty()) { return Stream.of(""); } return IntStream.range(0, str.length()).boxed() .flatMap(i -> permutations(str.substring(0, i) str.substring(i 1)).map(t -> str.charAt(i) t)); } | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
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. | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
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. 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. [Open Ended Answer] | ||||
![]() | ||||
![]() ![]() ![]() ![]() ![]() | ||||
| ||||
Ans. 59 23 28-31 * * [ "$(date +%d -d tomorrow)" = "01" ] && job_name | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
Ans. du -a /var | sort -n -r | head -n 10 | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
| ||||
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 | ||||
![]() | ||||
![]() ![]() ![]() ![]() | ||||
![]() ![]() | ||||