Morgan Stanley, Technology Associate
Status: New grad, B. Tech Computer Engineering, VJTI, Mumbai
Position: Associate at Morgan Stanley
Location: Mumbai / Bangalore
Date: 29th August, 2018
Selection Status: Selected
Round 1 : Coding and Aptitude (1 hr 30 mins)
There were 15 aptitude questions for 50 mks(No negative marking). They included quants, verbal and technical. Verbal also included sentence completion and critical reasoning type questions which are normally asked in GRE. Technical mcqs included OS, DBMS and DS concepts. I solved 7-8 questions. I am pretty sure all of them were correct.
There were 2 coding questions (50 mks):
Lily's problem : Lily has to solve a number of problems, each of them when solved correctly give her a certain happiness value. Each problem has a different happiness value. Lily has to solve the first problem but after that for every problem(i) she can either solve the next problem(i+1) or skip 1 problem to solve the (i+2)th problem. She has to keep on solving until the maximum-minimum happiness value of the problems solved is greater than some integer k. What are the minimum number of problems she has to solve in order to achieve this? (Dynamic programming).
This was a function based problem. The parameters were an array 'a' of ints and a string. Output is an int. The string parameter can have one of the following formats:
a[2+5+9] o/p: a[16] (16=2+5+9)
(38-92)[a] o/p : a[6] (6=38-92)
(a+7/59)[2] o/p : a[11] (11=7/59+2)
All the common precedence and associativity rules apply here. Any division is integer division.
Solution: Use infix to postfix conversion for evaluation of the expressions which are in string format.
I solved the second one. But I wasn't able to pass all the test cases. I was getting a compilation error in one section of the code which I commented out. But the rest was perfect.
The total score of apti and coding (marked according to the number of test cases passed) was taken into consideration.
Round 2 (3rd August): Technical Interview 1 (1 hr 15 mins)
Morgan Stanley prefers Java and/or C#. Even after me stating explicitly that I was most comfortable with C++, the interviewers during both the technical rounds went on with Java only.
Following are the questions I was asked:
Why do you prefer C++ ? (Used C++ for over 3 yrs. Never touched Java after sem 3 :P)
What is the difference between C++ and C#. Which is better? (C# can use the .NET framework and has many many built-in, ready to use library routines; C++ does not)
Why do you think C++ is better than Java. (Runs faster.) Why? (C++ compiles to machine code whereas Java compiles to bytecode.) What is bytecode? (Something that the JVM can understand :P) What is a JVM? Why do you say Java is an interpreted language? Is it really an interpreted language? Name some other interpreted languages Whatever I would say, he would catch a word from it and shoot me with another question!
What is inheritance? Its different types? Why multiple inheritance is not allowed in Java?(because of the diamond problem). What is the solution for implementing multiple inheritance in Java? (extend a class and implement an interface).
What is an abstract class? What is the difference between abstract class and interfaces? (Abstract classes can have default implementations for functions; interfaces cannot). Suppose I don't allow you to write the implementations for the functions in the abstract class, then which one is better? And why?
What is polymorphism? Its types? Why polymorphism?
He gave me a Java program and asked its output. It was about passing object references to functions. I was using my C++ concepts' knowledge to try and logically answer the Java questions ! Then he changed the program a bit and asked the o/p. I got this one wrong :(
Algorithm question 1: Given an array containing the prices of a particular stock at 10 mins interval. You have to buy and sell according to these prices. Write an algo/program to maximize the profits. In this they just try to check your approach.
Algorithm question 2: Given a binary tree. Make a mirror tree from it. This was easy. I was done with the algo and code within 10-15 mins. I used recursion. Asked me for a solution without recursion. Did that too.
A database query: Given an employees table, find all the duplicate employee names. Subquery and the keyword 'unique' were not allowed. I used the count aggregate function.
Then he moved to OS : Difference between process and threads. Thread scheduling: Whose responsibility is it, User or OS? (User library). He asked me 4 times if I was sure. I was confident about my answer.
Different libraries for creating XMLs and XSDs.
What is json? Difference between json and a normal object. Any alternative to json? I said maps: How are they implemented? (In C++ they are implemented using self balancing red black trees). Time Complexity: (C++ : O(logn). But if implemented using hashing and a good hash function: O(1).) What are the different hashing techniques? What is collision? Measures to resolve collision?
Any questions for me?
I knew I would go to the next round as he was looking very happy with my performance.
Round 3: Technical Interview 2 (1.5 hrs)
It began with a design problem: Design a hotel booking system, first the class diagram then the actual implementation. Every little detail was taken into consideration like the placement of attributes within the classes, the functions which should belong to the classes, the relationship between them, the attributes of the relationship, whether a particular information must be modelled as an attribute, a composition relationship or an inheritance relationship, handling of historic data without a database, etc. With each new concept came questions about it: What is the difference between composition and association? The four pillars of OOPs? Difference between abstraction and encapsulation? Why do we need abstraction? What are the different access modifiers and their significance?
We then began with the implementation of the above. Here also she wanted me to write code for every class and its functions. She wanted the code to be such that the system should be scalable and handle concurrent booking requests! I was not allowed to store the information in a database. So she asked me about the different data structures that I would use for storing all the info in main memory(or virtual) and to which class they should belong. The structure chosen should be such that searching for a free hotel room of a given type from a particular start date and to a particular end date must be efficient. I got stuck here and tried everything from a tree to a trie! In the end she told me a matrix would do the job and asked me for a space optimized solution(Hashmaps). I was asked to write an efficient hash function to search on the basis of the above mentioned parameters.
Concurrency control for the above: I said monitors. Then questions again followed: What are monitors? Other concurrency mechanisms? Difference between monitors and semaphores. Went into the implementation details of the two!
Next she gave me a program and asked the output. It was on virtual functions of C#. I didn't know anything about the C# new operator. I applied C++ virtual functions concept and logic to give the answers. They were correct :)
Why child class reference can't point to parent's object in Java/C++?
Asked me to solve the 8 Queens problem with full code.(Backtracking)
Asked about my work at a previous inetrnship. Any problems encountered? Alternate solutions to the utility I built? Why you didn't take the PPO?
Asked about the machine learning project.
Any questions for me?
Round 4: Pro-fit (45 mins)
This was an HR cum managerial cum tech round.
Why are you not involved much in competitive coding?
Asked about all my projects. Any projects done by own interest? Which is the most creative project done by you? Takeaways from the second year Java mini-project?
Asked in detail about the IOT project. Any scenarios in which it would fail? Possible solutions? Its uses?
Asked about the machine learning project? How did you get the data? Significance of the project.
What all input is needed for the google maps application? What new feature can you add to it that will involve machine learning? Which ML algorithm will you apply?
Scenario 1: If in a team project a member is adamant about his solution, what will you do if you are absolutely sure about your solution?
Scenario 2: What will you do if you find out that the code you released on the prod has bugs in it?
Scenario 3: What will you do if you are given a project in which you are not much interested?
Why Morgan Stanley?
Hobbies and interests
General background
She was very impressed by my answers and I was quite sure I would be selected :D
Tip: As long as your concepts are clear and you can answer logically you are good to go. Just be confident. That's probably the most important thing you will have to do during the interviews. And best of luck!
May, 2019: I have been working at Morgan Stanley for almost 9 months now. There is
absolutely no doubt that this is the place to start one’s career from. The best part is that they conduct a 4-month grad training course (TAP: Technology Analyst Program) which involves all the CS courses taught by experienced trainers of Mallon, London with hands-on experience of how to apply those as per industry standards. It is an absolutely brilliant start for setting one’s foot in the industry. Since the last 5 months I have been working as a Big Data Associate Engineer here at Morgan Stanley after the completion of TAP.