- What is an Immutable Class ? Why is it important in multi-threading context ? Can you write a Custom immutable class ? What are semantics for writing an Immutable Class in java ?
- How will you use your custom Object as a Key inside hashing datastructure (Hashmap, ConcurrentHashmap, hashSet, etc.)?
- Explain the working of put and get method of a hashmap class ? How does equals() and hashcode() comes into picture there ?
- What is difference between Executor Framework and ForkJoinPool ?
- What is difference between Executor.submit() and Executor.execute() method ?
- Write a code to iterate over a standard hashmap object in Java.
- What all things to keep in mind when you use Hashmap in multi-threaded environment ?
- What is difference between sleep() and wait() method ?
- What is Composite Design Pattern ?
- Write a code in java to remove elements of an array while iterating over it.
- What is ThreadLocal variable in Java ?
- What is pass-by-value and pass-by-reference ? Which mechanism is being used by Java ?
- Discuss through example, The Producer Consumer problem.
- Discuss how HashSet works internally in java ?
- Explain database normalization and its various usages.
- What are top 10 coding standards for code reviews in Java ?
- Write a recursive Java program to print Fibonacci Series ?
- How will you design a distributed algorithm for Prime Number generation in Java ? Discuss the Design only.
- How Garbage Collection works in Java, explain the underlying mechanism for any one of the Garbage Collector ? Give few names of existing garbage collectors ?
Sunday, April 19, 2015
- What do you understand by thread-safety ? What are various mechanisms to achieve thread-safety in java ?
- How will you design your own ReentrantReadWriteLock class where one thread can write and many threads can read in parallel ? How does it affect the throughput of a multi-threaded system ?
- What are various methods to acquire lock in java ? discuss their comparison.
- How to avoid deadlock in your application ?
- How is ConcurrentHashMap better than hashmap in java ?
- What are different memory generations in Java ? What is Stack and heap memory ?
- Write a thread-safe Singleton Java Class.
- What is difference between hashtable, hashmap and Concurrenthashmap in java ?
- What is difference between Iterator and ListIterator in Java ?
- What is Immutable Class ? What is reason behind using a Immutable class in your application ?
- What is difference between String, StringBuffer and StringBuilder ?
- What is difference between CheckedException and UncheckedException ? Give some example of RuntimeException ?
- What are different Bean scopes in Spring ? What is the default bean scope ?
- How many objects Spring container creates for a given bean definition ?
- What is Bean Lifecyle ?
- How do you encrypt a password in spring security ?
- Describe practical use of Spring Interceptors ?
- What is Servlet LifeCycle ?
- How do you declare a custom error page in Spring ?
- What is difference between doGet() and doPost() methods ?
- What is difference between Forward and Redirect ?
Saturday, April 18, 2015
There is a pricing service which connects to Reuters & Bloomberg and fetches the latest price for the given Instrument Tics. There could be multiple price events for the same Stock and we need to consider the latest one. Design a service to show prices for the Top 10 stocks of the Day ?
Excerpt taken from Book - "Cracking the Core Java Interviews 3rd Edition"
- There is a pricing service which connects to Reuters & Bloomberg and fetches the latest price for the given Instrument Tics. There could be multiple price events for the same Stock and we need to consider the latest one. Design a service to show prices for the Top 10 stocks of the Day ? Solution is discussed in eBook
- There is a very Big file containing many words, how will you read and process it to print the below information ?
a) Top 10 ranked distinct words.
b) Occurrence of each Alphabet in the file.
- How will you implement a Stack using a Queue ?
- How will you implement a Queue using a Stack ?
- How will you design a two way Elevator Software for a building ?
- What is Immutability ? How will you make a class Immutable in Java ?
- How will you achieve thread-safety in your Java Program ?
- What are the ways to increase throughput of a multi-threaded java program ? (concurrency enhancements - use java.util.concurrent package, connection pooling, other resource pooling, caching, GC tuning, etc.)
- How will you troubleshoot poor memory performance of a live production program ?
- How will you find a single duplicate number from a large array in minimum time ?