Interview Questions and Answers - Order By Newest Q1381. 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 Q1382. 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 Q1383. 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 Q1384. 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 Q1385. 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 Q1386. 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 Q1387. write program to do matrix multiplication Core Java
This question was recently asked at 'Kony Labs'.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 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 Substitutability in Java ? Core Java
Ans. Substitutability means that the type of the variable does not have to exactly match with the type of the value assigned to that variable. For example - Object reference of Parent object can hold derived object. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Q1391. 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 Q1392. 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 Q1394. 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 Q1395. 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 Q1396. 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 Q1397. What is the difference between RollingFile and RollingRandomAccessFile in log4j ?
Log4j
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  log4j  RollingFile  RollingRandomAccessFile Q1398. Can you organize following Log4j levels in hierarchy ?
WARN, DEBUG,INFO, ERROR Log4j
Ans. DEBUG
INFO
WARN
ERROR
Root Log level of DEBUG will print all
Root Log Level of INFO will print INFO, WARN and ERROR
Root Log level of WARN will print WARN and ERROR
Root Log level of ERROR will print ERROR alone Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  Log4j levels hierarchy  Log4j Q1399. 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 Q1400. 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 Q1401. Given array of integers, find first two numbers that adds up to 10. Core Java
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  Code  Coding Asked in 1 Companies Q1402. Write a program to reverse words of a sentence. Core Java
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  code  Coding Asked in 1 Companies Q1403. how to get most significant bit from a byte? Core Java
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 Q1404. 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 Q1405. 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 Q1406. Explain different sorting algorithms and Big O of each Algorithm
This question was recently asked at 'Microsoft,ServiceNow'.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 Q1407. Write a program to find loop in a linked list 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 Q1408. What is RPM ? Tool
Ans. Redhat Packaging system or rpm is a Package Manager or type of Package Management system extensively used for Linux systems. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  rpm  package managementAns. Priority inversion is a problematic scenario in scheduling in which a high priority task is indirectly preempted by a lower priority task effectively inverting the relative priorities of the two tasks. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve   Asked in 5 Companies Q1410. What is the difference between session.clear and session.evict ? Hibernate
Ans. session.clear clears all the objects from session whereas session.evict is used for evicting a particular entity. Help us improve. Please let us know the company, where you were asked this question : Like Discuss Correct / Improve  hibernate session clear  hibernate evict Try 2 Question(s) Test