Daily Archives: May 19, 2010

Part 2 of potential Morgan Stanley interview questions on Java

Part 1 of potential Morgan Stanley interview questions on Java

Now I need to bone up for a Morgan Stanley Java related position. The job focuses on the classic Hibernate, Spring, and Messaging related (i.e. JMS).
From Glassdoor, I gleaned they will ask about:

Talk about collection framework of Java.
What will happen if we add the same object to the Set?
[Full Interview Report]

What is reflection?
What is JIT?
Difference between hashmap and hashset?
Know Generics
How to check for memoery leaks?
Difference between final, finally, and finalize?
We can find out whether a singly linked list has a loop in it using 2 pointers(another common interview question). How can we find the start of the loop?
For e.g. given 1–>2–>3–>4–>5
| |
8<--7<--6 How will u find out that '3' is the start of the loop? http://www.careercup.com/question?id=2637 Write Fibonacci sequence? Database /SQL related: 1. Difference between clustered and non clustered index 2. Difference between having and where 3. What is query optimization 1 Design an algorithm to find the frequency of occurance of a word in a book 8 [Full Interview Report] What are the interfaces in Collection classes that you worked with? (Collection, Set, Map, List, Queue) 2 Check out http://www.careercup.com/question?id=56632 What is the use of volatile variable. Explain it in Singleton class also for lazy initialization. with volatile variable we can make sure that multiple threads have exactly same copy of variable at any given time. Compared to Synchronized keyword access/update overhead is less as only single variable needs to be synchronized rather than every every field in the class. What is the limitation of singleton pattern Only has one instance. http://en.wikipedia.org/wiki/Double_checked_locking_pattern What was the problem in implementing double checked locking before java 1.5. Double-checked locking is actually OK as of Java 5 provided that you make the instance reference volatile If there are Million threads accessing this method, as you used synchronized all the other threads has to wait, which makes the application to run slower. So how can you achieve thread safe with out using synchronization? Difference between String and StringBuffer? Interface vs. abstract class Choosing interfaces and abstract classes is not an either/or proposition. If you need to change your design, make it an interface. However, you may have abstract classes that provide some default behavior. Abstract classes are excellent candidates inside of application frameworks. Abstract classes let you define some behaviors; they force your subclasses to provide others. Those services allow your application to plug in to your application framework. However, there is some application-specific functionality that only your application can perform. Such functionality might include startup and shutdown tasks, which are often application-dependent. So instead of trying to define that behavior itself, the abstract base class can declare abstract shutdown and startup methods. Cup

NOTE I now post my TRADING ALERTS into my personal FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!