Face to Face Java Interview Series 46
This is next face to face series second round of interview in BNP Paribas for Sr. Java Developer position. Interview was Sr. Architect seemed very knowledgeable as he has asked below questions:
1. Do you know spring tell me how you load application context
2. Let’s say you XML file where many beans are defined and some point of time working on class you need that bean how will you get that instance –> Actually he was asking about you will multiple times application context or only single times. If its single times what you will do –> Answer was use Singleton pattern
3. What is Singleton pattern how you create it and what is the best to create it –> User Enum
4. How do you create thread in Java
5. How you start thread in Java
6. What happens if you call start two times on same object like obj.start() and obj.start() –> Answer: It is never legal to start a thread more than once. In particular, a thread may not be restarted once it has completed execution. Throws: IllegalThreadStateException – if the thread was already started.
7. What is difference between daemon and non daemon thread
8. How you used Executor interface what is this and how you use it
9. Difference between Executor and completion service
10. What is difference between Countdown latch and Cyclic barrier and how it works
11. What is Adapter pattern
12. What is difference between String literals and String object
13. Where String literals got save in JVM memory
14. What else got save in PERM area
12. What is dead lock why it happens
13. How you find dead lock and resolve it
14. Let’s say you have millions of records and pulling it through database what is efficient way to iterate it –> Basically he was asking about to set fetch size in statement so that data can be fetch by size and it won’t take much memory in JVM. By default JDBC set fetch size 50
15. What is volatile variable when and how you use it
16. Have you worked with Atomic interface how you use it
17. What is the difference between Atomic integer and volatile variable
18. How hibernate works
19. Let’s say you have million of person object which we need to insert to the data base how will you do that and before that can you tell if hibernate insertion is stateful or stateless
20. What are they ways you could insert/update/delete data in hibernate
21. What is difference between runnable and callable interface
22. How do you clone object in java
23. Is clonning does deep copy or shallow copy
24. What are other way you could do object deep cloning without using clone –> He was asking to use Serializable interface