Interview Questions and Answers - Order By Newest Q1381. What was the worst problem you faced while working with Hibernate ? Hibernate
Ans. Lazy Initialization exceptions Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q1382. Is it advisable to keep session or transaction open for long time just to avoid LazyInitializationException ? Hibernate
Ans. No. It's a resource and performance overhead. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  LazyInitializationException  Lazy Loading Q1383. How to create list that will sort it's elements dynamically? Algorithm
Ans. Override the behavior of collection class to sort the list upon each element addition. Though it's not recommended as list are sorting heavy data structures.
List<MyType> list = new ArrayList<MyType>() {
public boolean add(MyType mt) {
super.add(mt);
Collections.sort(list, comparator);
return true;
}
}; Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies intermediate Q1384. What is an execution engine within JVM ? Core Java
Ans. Execution engine contains interpreter and JIT compiler, which covert byte code into machine code.
Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  jvm  execution engine  compiler Asked in 1 Companies Q1385. What are some of the Java Naming conventions ? Core Java
Ans. 1. Class name should be a noun and should start with capital case character.
2. Interface Name should be an adjective and should start with capital case character.
3. Method and Variable names should follow lower camel case notation.
4. package name should be all lower case.
5. constant variables (static final) should be all capital case. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  naming conventions basic Q1386. what is the repository structure in svn ? SVN
This question was recently asked at 'Sri Tech'.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 Q1387. Write program to create a linked list and perform different operations on it. Algorithm
Ans. import java.util.*;
class LinkedListSolution{
protected LinkedList list;
public LinkedListSolution(){
list = new LinkedList();
}
public Object pop() throws NoSuchElementException{
if(list.isEmpty())
throw new NoSuchElementException();
else
return list.removeFirst();
}
public void push(Object obj){
list.addFirst(obj);
}
public Object peek() throws NoSuchElementException{
if(list.isEmpty())
throw new NoSuchElementException();
else
return list.getFirst();
}
public boolean isEmpty(){
return list.isEmpty();
}
public String toString(){
return list.toString();
}
}
class TestStack{
public static void main(String args[]){
LinkedListSolution s = new LinkedListSolution();
s.push("First");
s.push("Second");
s.push("Third");
System.out.println("Top: " s.peek());
s.push("Fourth");
while(!(s.isEmpty()))
System.out.println(s.pop());
}
} Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Linkedlist  data structures  algorithm Asked in 2 Companies basic Q1388. Can the foreign key column have null values ? Database
This question was recently asked at 'Volkswagen It services'.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 Q1389. How do threads share information ? Core Java
Ans. Through common memory area. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  threads Asked in 1 Companies Q1390. What is the precedence of operators in Java ? Core Java
Ans. http://introcs.cs.princeton.edu/java/11precedence/ Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  operators  operator precedence basic Q1391. Can we override abstract methods ? Core Java
Ans. Abstract methods are the methods that need to be overridden in the derived class ( either as implementing method or again abstract method ) so it's not only allowed but its required to override abstract method in the derived class. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  overriding  abstract methods  overriding abstract methodsAns. Access Control List or ACL is the list of permissions attached to an object in the File System. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  acl  file system  file security  object security  operating system Q1393. Write a Program to delete a node from Linked List ? Data Structure
This question was recently asked at 'Caprus IT'.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  linkedlist  delete a node from linked list Asked in 1 Companies Q1394. Can we override an abstract method with abstract method in the derived class ? Core Java
Ans. Yes, but in that case the derived class itself should be abstract. We cannot have an object of a class without definition for the method which has been declared abstract in the parent. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  overriding  overriding abstract methods  abstract methods Q1395. What is the difference between TimeBasedRollingPolicy and SizeBasedTriggeringPolicy within Log4j ? Can we use both together and What would that mean ? Log4j
Ans. TimeBasedRollingPolicy enables rolling of logs based on the time / days whereas SizeBasedTriggeringPolicy enables rolling of logs based on size cap.
Yes we can use both together. In that case Logs will be rolled in case any of the condition is met i.e after the interval or if the size is reached. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Log4j  TimeBasedRollingPolicy  SizeBasedTriggeringPolicy Q1396. What is the difference between DEBUG and TRACE logging levels ? Log4j
Ans. TRACE designates finer grained informational events than the DEBUG.TRACE is level lower than DEBUG. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Log4j  DEBUG vs TRACE Q1397. how many reducer task runs on a hadoop cluster ? BigData
Ans. Generally one reducer runs for all mappers, but it can be increased as per requirements. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Hadoop  BigData Asked in 1 Companies Q1398. What is the use of Property files ?
Ans. Property files are used to maintain configurable values as key value pairs. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  config  property files This question was recently asked at 'Veritas'.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  Mutex vs Semaphore Asked in 1 Companies This question was recently asked at 'Veritas'.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 This question was recently asked at 'Veritas'.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 This question was recently asked at 'Veritas'.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 Ans. array is traversed from first element to last element. Here current element is compared with next element. If current element is greater than next element it is swapped. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  sorting  bubble sort Asked in 1 Companies Q1404. Write code to check if a Binary tree is symmetrical Algorithm
This question was recently asked at 'Amazon'.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  binary tree Asked in 1 Companies Q1405. What data structure will you use if we have to search an element in million of elements ? Data Structure
This question was recently asked at 'Microsoft'.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  Search Asked in 1 Companies Q1406. Write a function that returns the depth of a tree. Algorithm
This question was recently asked at 'Amazon'.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 Q1407. Write code to find the node where two linked lists intersect. Algorithm
This question was recently asked at 'Amazon'.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 Q1408. Check if tic tac toe has a winner Algorithm
This question was recently asked at 'Microsoft'.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 Q1409. Write program to balance a binary tree Algorithm
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   Q1410. Given a graph, find if it represents a tree Algorithm
Ans. We can simply find it by checking the criteria of a tree. A tree will not contain a cycle, so if there is any cycle in the graph, it is not a tree. We can check it using another approach, if the graph is connected and it has V-1 edges, it could be a tree. Here V is the number of vertices in the graph Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 1 Companies