Multi-threading Java Interview Questions for Investment Bank

Upasana | July 25, 2020 | 4 min read | 751 views


  1. What do you understand by thread-safety? Why is it required? And finally, how to achieve thread-safety in Java Applications?

    Hint : discuss the need for the concurrent programming, using volatile, synchronization, Immutability & Atomic packages to address the concurrency problems. Discuss the Java Memory Model. Impact of final keyword in Java. Differences between wait and notify method in Object class.

  2. What are the drawbacks of not synchronizing the getters of an shared mutable object?

  3. Discuss the Singleton Design Pattern? How to make it thread-safe? Discuss the Double Check Locking (DCL)?

  4. Can Keys in HashMap be made Mutable? What would be the impact in that case?

  5. How would you implement your own ThreadPool in Java? Discuss the designing part.

  6. How would you implement a Stack or a Queue in Java? It must be synchronized.

  7. Discuss Big O notation for calculating relative performance of Algorithms. How do various collection methods perform in terms of Big O Notation?

  8. Implement Queue using an ArrayList.

  9. What are the types of Inner classes with example of each?

  10. What is a tree map? Discuss its underlying implementation i.e. red-black binary tree.

  11. There are 1 million trades, you need to check if a given trade exists in those trades or not. Which Collection would you chose to store those 1 million trades and why? Hint : think from time complexity point of view and why HashSet could be a better data structure for storing these trades assuming we have sufficient memory to hold those items.

  12. What is difference between StringBuilder and String? Which one should be preferred.

  13. In a program, multiple threads are creating thousands of large temporary StringBuilder objects. Life span of all those objects is 1 GC cycle. But somehow we are getting JVM pauses in our application. How would you troubleshoot the problem? Hint : Think from GC tuning perspective

  14. What are memory generations in Hot Spot VM? How generational GC’s work?

  15. What is difference between Primary Key and Unique Key?

  16. What is clustered and non-clustered index in Sybase database?

  17. What is Outer and Inner Join?

  18. What is ADT? We do not need to know how a data type is implemented in order to be able to use it.

  19. Are you familiar with a messaging system i.e. MQ? What is a QueueManager? Why do you think the Queue is so important in banking world?

  20. How would you make an application asynchronous? Can Message Queues help achieving this?

  21. How to achieve loose coupling in your application?

  22. What is TDD and how it helps Agile methodology of software development?

  23. How to make a class Immutable? What purpose does it solve?

  24. What is difference between Callable and Runnable?

  25. What are Inheritance strategies in JPA?

  26. Discuss Internals of HashMap and ConcurrentHashMap?

  27. What is best way to store Currency Values in Java application?

  28. What is AtomicInteger and how it is useful in concurrent environment?

Design Interview Questions

  1. What are key principles while designing Scalable Software Applications?

  2. What does Collections.unmodifiableCollection() do? is it useful in multi-threading environment?

  3. How would you add an element to a Collection while iterating over it in a loop?

  4. There are 3 Classes A, B and C. C extends B and B extends A, each class has a method named add() with same signature (overriding). Is it possible to call A’s add() method from Class C? Reason?

  5. How would you write a simple Interceptor in Struts 2 which can log the request and response to an Action?

  6. What are database transaction isolation levels? What is the default value for transaction isolation level.

  7. How does Session Handling works in Servlet Environment?

  8. What is difference between Http’s redirect and forward request?

  9. Iterator Interface provides a remove() method but no add() method, Why?

  10. Can you give a try writing a rough Implementation for BlockingQueue in Java?

  11. What are Common Threading Issues in Java?

Algorithms and Datastructures

  1. Given a Collection of 1 million integers ranging between 1 and 9, Can you sort them all in Big O(n) time?

  2. How would you resolve Task Inter dependency pragmatically as is done in Ant?

  3. How would you sort 900 MB of data using 100 MB of RAM?

  4. What do you understand by GC tuning, What are GC pauses (stop the world)? How would you tune a given Java Program?

  5. What is a PriorityQueue? How is it implemented in Java? What are its usages?

  6. Your are give a file with millions of numbers in it. Find the 20 biggest numbers?

  7. What is difference between synchronized HashMap and a hashtable?

  8. What do you understand by Token Bucket Algorithm. What are its applications?

  9. What are the key principles when designing a software for performance efficiency?

  10. How would you describe Producer Consumer problem in Java?

  11. Design Phone Book for a mobile using TRIE (or a prefix tree)

  12. How would you count word occurrence in a very large file? How to keep track of top 10 occurring words?

  13. What happens when you type a url in browser’s address bar?

  14. Design a Pricing Service that lists top 10 stocks of the day.

  15. Is it possible to make an array volatile in Java to write thread-safe code?


Buy my ebook for complete question bank

Most of these questions has been answered in my eBook "Cracking the Core Java Interview" updated on June 2018, that you can buy from this link:

Buy from Shunya (DRM Free PDF download with updates)

Top articles in this category:
  1. Citibank Java developer interview questions
  2. RBS Java Programming Interview Questions
  3. UBS Java Interview Questions
  4. Morgan Stanley Java Interview Questions
  5. Cracking core java interviews - question bank
  6. BlackRock Java Interview Questions
  7. Sapient Global Market Java Interview Questions and Coding Exercise

Recommended books for interview preparation:

Find more on this topic: