Interview Questions and Answers - Order By Newest Q2021. How to sort objects based on one of the field ? Core Java
Ans. Using comparable and comparator and sorted collections like TreeSet or TreeMap.
or
use stream api from java 8 onwards which internally refers to comparable and comparator through lambda expressions Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  sort  sorting  comprator  comparable  treeset  treemap  sorting collections Asked in 1 Companies Basic   frequent Q2022. Given an Employee Table with Salary Column, Find 2nd and 5th highest salary in a particular department. SQL
Ans. Select salary from (select salary from employee where department = order by salary desc limit 5) emp order by salary limit 1 AND Select salary from (select salary from employee where department = order by salary desc limit 2) emp2 order by salary limit 1 Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  sql  database   find 2nd highest salary sql database Asked in 1 Companies Q2023. Difference between Component-Scan and @Component annotation ? Spring
Ans. @component mark a java class as a bean so that component scan mechanism of spring pick it up and register in IOC container. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q2024. Can we have interface as a replacement for utility class ? Core Java
Ans. Yes, With Java 8 we can use Interfaces as collection of utility methods through the use of default methods. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java 8  interfaces  utility class   utility classes Q2025. What are custom annotations and How can we create one ? Core Java
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  annotations  custom annotations basic Q2026. While working on a web application, you are informed that there is no new data in Database for last few hours ? How would you go about debugging this problem ?
Solution
Ans. Will look into access logs to see if web application is getting any traffic. If not , then will inform the server support team.
Will look into intermediary infrastructure , queues , streams etc to see if there is any choke or throttle there.
If there is any throttle at any point, would make request for either debugging the cause or increasing the infrastructure. For ex - increasing shards in Kinesis. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Solution  Designing  Solutioning Asked in 2 Companies Q2027. Set Locators priority wise in selenium WebDriver. Selenium
Ans. Id locators,Name locators,CSS locators,Xpath locators,DOM locators Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  selenium  WebDriver Asked in 1 Companies Q2028. Which memory segment is cleaned by Garbage Collection - stack or heap ? Core Java
Ans. Heap as objects are stored ink heap. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  memory management   stack  heap  garbage collection Q2029. Have you worked on Linux Systems ? General
This question was recently asked at 'HCL Technologies,Symantec'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 2 Companies Q2030. What is OSGI ? OSGI
Ans. OSGI is open service gateway initiative, its used as java framework for developing and deploying the modular softwares. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 23 Companies Q2031. What is the use of load-on-startup ? Design
Ans. The load-on-startup element of web-app loads the servlet at the time of deployment or server start if value is positive. It is also known as pre initialization of servlet.You can pass positive and negative value for the servlet. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  load on startup   web application Asked in 1 Companies Q2032. Are final methods faster than regular instance methods ? Core Java
Ans. Yes. As they cannot be overridden , there is no use of virtual table concept which is used for dynamic binding resolution. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  final methods   final keyword expert Q2033. What is virtual table with respect to method overriding in Java ? Core Java
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  vtable  virtual method table   method overriding  runtime polymorphism  object oriented programming (oops)  oops concepts Q2034. How is the virtual method table implemented in Java? Core Java
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  virtual method table   method overriding  runtime polymorphism  object oriented programming (oops)  oops concepts expert   rare Q2035. How many VTables are there for each class ? Core Java
Ans. There is one VTable for each class. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  virtual table method  vtable  runtime polymorphism  object oriented programming (oops)  oops concepts   method overriding intermediate   rare Q2036. Can an In Memory Data Management play a significant role for Big Data Analytics? BigData
This question was recently asked at 'Jean Martin'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q2037. Explain the use of Client certificates for authentication ? Authentication
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  authentication  client certificates Q2038. How cookies helps by storing encrypted passwords ? Authentication
Ans. It helps user autofill password on the form where its presented for authentication Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  cookie  authentication Q2039. Have you ever worked with encrypted Tokens and How ? Authentication
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q2040. How did you use authentication in node.js ? Node,js
Ans. Using JWT Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  authentication  node.js Asked in 2 Companies Q2041. How to deal with double hop authentication issue? Authentication
This question was recently asked at 'Bank Of America'.This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q2042. Have you ever used java.util.Objects class ? Core Java
Ans. Yes, We are using requireNonNull method for validating if the object is null. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  objects  util methods   rare Q2043. If a high CPU Usage happens everyday at a particular time, How would you go about fixing it ? Server
Ans. We can provision more instances for that particular time slot. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  aws  amazon web service   server  production support Asked in 1 Companies This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  aws  amazon web service  Azure Q2045. What is a reflexive equals contract ? Core Java
Ans. An equal contract is said to be reflexive is equality between 2 objects always returns to be true.
For example -
Object o1;
Object o2;
o1.equals(o2); // returns true
o2.equals(o1); //returns true Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  reflexive equals contract Q2046. Explain Transitive equals contract. Core Java
Ans. The equals contract is said to be transitive if
obj1.equals(obj2); and obj2(.equals(obj3)
then obj1.equals(obj3) also returns true. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Transitive equals contract   rare Q2047. What sets you apart from other developers ?
or
What are the distinguished qualities you have ? General
Ans. https://blog.timesunion.com/careers/the-10-most-important-personality-traits-for-career-success/633/ Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 32 Companies Q2048. Create an event class in Java. Core Java
This question is still unanswered. Can you please provide an answer. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  event class Q2049. How does multi threading improve performance ? Core Java
Ans. Every process in it's timeline require different resources. Utilization of resources can be optimized when they are shared among different processes or threads. When one thread is sleeping waiting for a peripheral to complete (e.g. a disk write, or a key press from the keyboard), other threads can continue using processor time and hence would lead to better usage of resources. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  multithreading  threads basic   frequent Ans. Time Slicing is the process to divide the available CPU time to the available runnable threads. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Time Slicing  threads  thread scheduling   thread scheduler