Interview Questions and Answers - Order By Newest Q2261. Difference between Eager and Lazy loading in hibernate ? Hibernate
Ans. Lazy Loading is loading of entities on demand when subclass is called, while Eager loading is loading of all the sub entity at the start only.
Eager loading is fast as all sub entities are already present, but its heavy(takes more memory) Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q2262. Should we have instance variables in the Spring Bean which has been scoped as Singleton ? Spring
Ans. No, if required we should only have final variables. Bean scoped singleton means that only one instance of the bean will be created and will be shared among different requests and hence instance variables will get shared too. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  singleton Asked in 1 Companies Q2263. what are the different criterions that can be specified while updating bids ? Adwords
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   Q2264. What is the difference between bid modifier and bid adjustment ? Adwords
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  Ans. public class StackUsingArrayList {
public static void main(String[] args) {
List list = new ArrayList();
list.add("A");
list.add("B");
list.add("C");
Stack stack = new Stack();
list.forEach(a -> stack.add(a));
System.out.println(stack);
}
} Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies Q2266. Mention the implicit objects in jsp JSP
This question was recently asked at 'IBM'.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 Q2267. What are the ways to break singleton pattern ? Design
Ans. If we don't have double checked locking, it can be broken easily through multi threaded access.
Through Reflection.
If multiple class loaders are loading the class.
If the class is serializable or cloneable.
Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  singleton Asked in 2 Companies expert Q2268. Why the singleton class should never implement Cloneable interface ? Design
Ans. Because Singleton implementation doesn't restrict it from cloning and hence we can have multiple objects when we actually don't intend it to have multiple objects. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  singleton  cloning Q2269. How serialization breaks Singleton pattern ? Design
Ans. It's not serialization but de serialization that breaks purpose of singleton as new objects can be brought to life using the serialized object. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  singleton Q2270. How Reflection can break any design pattern ? Design
Ans. Using java reflection api, we can tweak into a class and modify it's runtime behavior and hence modify the pattern it might be using. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  reflection Q2271. Can you explain following exception
java.lang.ArithmeticException: Non-terminating decimal expansion; no exact representable decimal result. 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  ArithmeticException Q2272. What are we doing here
list.stream().collect(Collectors.groupingBy(ClassA::getElement1,
Collectors.averagingDouble(ClassA::getelement2))); Core Java
Ans. We are averaging elements of a collection by element1 grouped by element1
* list is the reference of collection
* element1 is the member element returned by getElement1 method of ClassA
* element2 is the member element returned by getElement2 method of ClassA Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java 8  collections  java 8 streams  collectors Q2273. What will the following code return
list.stream().collect(Collectors.groupingBy(ClassA::getElement1,
Collectors.averagingDouble(ClassA::getElement2))); Core Java
Ans. Map<DataType1,DataType2> where DataType1 is the data type of element1 ( returned by getelement1 method ) and DataType2 is the data type of element2 ( returned by getElement2 method ) Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  java 8  collections  java 8 streams Q2274. What is the advantage of BidDecimal over Double ? Core Java
Ans. BigDecimal provides more precision as compared to double. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  BigDecimal  Double  data types Q2275. What does @VisibleForTesting annotation denotes ? Testing
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  VisibleForTesting Q2276. What is the difference between following rounding modes
RoundingMode.CEILING
RoundingMode.DOWN
RoundingMode.FLOOR
RoundingMode.HALF_DOWN
RoundingMode.HALF_UP
RoundingMode.HALF_EVEN
Which is the one you use often and Why ? 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  RoundingMode 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 Lambda 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 lambda  aws serverless computing  amazon cloud serverless computing  amazon lambda 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  AWS Lambda Q2280. Have you worked on creating any cron job ? 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   Q2281. Have you used any framework to capture command line arguments or options ? 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   Q2282. Can we build an application that where few functions gets executed as a cron as well as services. How ? Design
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   Q2283. What are different in memory data structures that are used in No Sql Database ? NoSql Database
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   Q2284. What are different types of No Sql Databases ? NoSql
Ans. graph based
column based
document based Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q2285. How would you choose your favorite company name for e.g. three companies are given in radio buttons Infosys, TCS and Aricent. Do You need to loop trough all radio buttons and select your favorite company or can just get the selected value. Javascript
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   Q2286. Write code to get count of every 5 letter word in a string using lambda expression
Core Java
Ans. String str = "I had been saying that he had been there";
Map<String,Long> countWords = Arrays.asList(str.split(" ")).stream().filter(p->p.length() = 5).collect(Collectors.groupingBy(p->p,Collectors.counting()));
System.out.println(countWords); Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Collectors  lambda  filter  coding  java 8 Q2287. Can you write code so that we can keep track of Keys that have their values changed along with the number of times they were changed. 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  Ans. Use hashCode() which returns an integer value, generated by a hashing algorithm Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hash codes  hashcode Asked in 1 Companies Q2289. What are the different types of methods in Java ? Core Java
Ans. Static Methods
Instance Methods
Accessor / Mutator or getter setters Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q2290. Are getters setter / accessor mutator methods instance methods or static methods ? why ? Core Java
Ans. They are usually instance methods. They are usually applied to DAOs / DTOs / POJO that are used to transport objects and used to access object elements. As they are tied to objects and are not common to all objects of a class, hence they are created as non static. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve