Xactly Corp. interview question

1. How HashMap works internally? 2. How does the data stored in HashMap or HashTable? 3. What is hashing and collision and collision detection? What does java during collision detection? 4. What is rehashing? Why it is not thread safe, what will happen if 2 threads trying to rehash? 5. How to create custom immutable object? Say you have and employee class with name and salary as attributes. You have one object created and now you have to increase the salary by 2 and how you ensure the immutability for the previous object? 6. How you can say String in immutable? 7. How array list works? 8. Design patterns used in your project, explain them? a. Singleton b. Factory Pattern c. Abstract Factory Pattern d. Proxy Pattern e. MVC Pattern f. Builder Pattern 9. Pass by value and Pass by reference in java? 10. You are given series of ‘a’ and ‘b’ alphabets in random order, example “aaabaabbbbaaaba”. You should use stack data structure and use only pop, push and peep operations to find out which alphabet has more count. 11. You have doubly linked list. You have two pointers one is at head and another one is at end. You should use only hasNext(), hasPrevious() and next() methods. How will you find the mid element? 12. Why do you need comparator and comparable? When will you use those, tell me real time usage? 13. Design online snake and ladder. a. Write API/Rest calls? b. What data structure you would use for gaming logic? c. How you synchronize among players? 14. What is Kryo? Why it is faster than java serialization? 15. Difference between wrapper connection pooling and native connection pooling? 16. How would have make sure the session is intact, if a web-server is goes down in a clustered web-server environment? 17. You have 2 different ORACLE nodes. You have 2 records to be stored in these nodes such way that record1 to node1 and record2 to node2. How will you make sure the transaction in case of system failure? 18. Difference between MongoDB and Cassandra? 19. Apache storm and Kafka? 20. CAP theorem in No-SQL DB?