Friday, December 18, 2015

Java Multi-Threading Questions

1. What is Double Brace Initialization in Java?  [ Ans... ]

2. Difference between HashMap, LinkedHashMap and TreeMap in Java?  [ Ans...]

3. Difference between CyclicBarrier and CountDownLatch in Java? [ Ans... ]

4. What is volatile variable in Java? [ Ans... ]

5. What is thread-safety? is Vector a thread-safe class? [ Ans... ]

6. What is race condition in Java? Given one example? [ Ans... ]

7. How to stop thread in Java? [ Ans... ]

8. What happens when an Exception occurs in a thread? [ Ans... ]

9. How do you share data between two thread in Java?

10. Difference between notify and notifyAll in Java? [ Ans... ]

11. Why wait, notify and notifyAll are not inside thread class?  [ Ans... ]

12. What is ThreadLocal variable in Java?  [ Ans... ]

13. What is FutureTask in Java?  [ Ans... ]

14. Difference between interrupted and isInterrupted method in Java?

15. Why wait and notify method are called from synchronized block?  [ Ans... ]

16. Why you should check condition for waiting in a loop?

17. Difference between synchronized and concurrent collection in Java?

18. Difference between Stack and Heap in Java?

19. What is thread pool? Why should you thread pool in Java?  [ Ans... ]

20. Write code to solve Producer Consumer problem in Java?  [ Ans... ]

21. How do you avoid deadlock in Java? Write Code?

22. How do you check if a Thread holds a lock or not?

23. Difference between synchronized and ReentrantLock in Java?  [ Ans... ]

24. There are three threads T1, T2 and T3? How do you ensure sequence T1, T2, T3 in Java?  [ Ans... ]

25. What does yield method of Thread class do?

26. What is concurrence level of ConcurrentHashMap in Java?

27. What is Semaphore in Java?

28. What happens if you submit task, when queue of thread pool is already fill?

29. Difference between submit() and execute() method thread pool in Java?

30. How to create Immutable object in Java?  [ Ans... ]

31. What is ReadWriteLock in Java?

32. What is busy spin in multi-threading?

33. Difference between volatile and atomic variable in Java?

34. What happens if a thread throws an Exception inside synchronized block?

35. What is double checked locking of Singleton?  [ Ans... ]

36. How to create thread-safe Singleton in Java?  [ Ans... ]

37. What is difference between calling wait() and sleep() method in Java multi-threading?

38. What is fork join framework in Java?

39. How do you force start a Thread in Java?

[ Source ]


No comments:

Post a Comment