Monday, June 2, 2014
Question Series - Common Questions
Question 1: How would you improve performance of a Java application
Answer:
1. Pool valuable system resources
2. Optimize IO Operation
3. Minimize Network overhead
4. Check if you have memory problem and manage object efficiently.
Question 2: What is the performance tips?
1. ArrayList/Hashmap over Vector/Hashtable
2. Set proper initial size for collections
3. Don't use exception to control flow
4. Minimize casting
5. Avoid using system.out, use log4j
Question 3: How would you detect and minimise memory leaks in java ?
Detect memory leaks
1. Use tool like JProbe
2. Use OS Process Monitor
3. use totalMemory and freeMemory
Minimize memory leaks:
1. Use object's lifecycle
2. Unreachable collection objects cause memory problem
3. Use WeakHashMap
4. Free native resources
Question 4: Why out of memory error happens?
1. Increase heap size. Java -Xms1024M -Xmx1024M
2. Increase perm size. Java -XX:PermSize=256M -XX:MaxPermSize=256M
3. Have memory leak in your app
Question 5: Why does the JVM crash with a core dump or Dr. Watson error?
1. Use JNI Code
2. The OS needs a patch
3. JVM has a bug for translation
Question 6: What design patterns have you used before ?
1. Strategy, Iterator, Decorator, Visitor, Singleton, Factory, Command and MVC.
2. UML, BusinessDelegate, VO
Question 7:
Labels:
Interview
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment