Code Pumpkin

Morgan Stanley Interview Questions – Set 5

October 8, 2017
Posted by Rahul Jain
Subscribe

I have appeared for Java Developer requirement at Wissen Infotech, Bangalore Location. Requirement was for their client Morgan Stanley and it was my second telephonic interview round with Morgan Stanley. Duration : 30 Minute.

I have also shared my interview experience with Wissen Infotech as well as my first interview round with Morgan Stanley


  1. Tell me about your current Project.
  2. How to create Immutable class?  (Answer)
  3. Suppose, I have class Employee with three fields as below:

class Employee{
    int empId;
    String empName;
    Address empAddress;
}

class Address{
}

– How will I make Employee as Immutable class.
– If Address is also a mutable object. How will you handle it?

  1. What is deep copy? How it will be useful in Immutable objects?
  2. How does HashMap work internally? tell me about hashCode()  and  equals() method.
  3. How does TreeMap work internally? Do we need to implement hashCode() and equals()? 
  4. Which method should we implement in case of TreeMap?
  5. Difference between HashMap and ConcurrentHashMap.
    Answer : 
    ​- 
    HashMap is not thread-safe.
    ConcurrentHashMap is a thread-safe.
    – For detailed understanding, please read our article Hashtable Vs SynchronizedMap Vs ConcurrentHashMap
  6. How does ConcurrentHashMap work internally?
    Answer : 
    – Instead of acquireing a lock on entire Map object like SynchronizedMap, ConcurrentHashMap devides map in different segements and each thread can aquire a lock on individual segment. so at a time multiple threads can write in different segments but not in the same segement. Also this lock is required only in write operation.  Multiple threads can read concurrently from the same segement.
  7. Tell me about ExecutorService.
  8.  If I am having a file of size 10GB. I want process that file, how will I do that?
  9.  I am having array which is increasing upto one element and then it decreses. Find the pick elements.
    For example, 

                10 30 40 50 20 5 4 1
                Answer : 50
    
    

  1.  For below given SQL Table
Emp_Id Employee_Name Mgr_Id
100 Prateek
101 Kapil 100
102 Prakash 101
103 Jack 101

Write a query to fetch result as below

Employee_Name Manager_Name
Prateek
Kapil Prateek
Prakash Kapil
Jack Kapil

This article is contributed by Rahul Jain. If you would also like to contribute your article or share interview experiences, you can create contributor account with codePumpkin by clicking here.

Tags: , , , , , ,


Comments and Queries

If you want someone to read your code, please put the code inside <pre><code> and </code></pre> tags. For example:
<pre><code class="java"> 
String foo = "bar";
</code></pre>
For more information on supported HTML tags in disqus comment, click here.

Total Post : 80
Subscribe
Contribute Your Articles

Interview Experiences

Related Books

Like Us On Facebook

Alexa Page Rank