Tuesday, August 23, 2011

Night Before the Interview

This interview process is for the profile of IT Analyst position in Morgan Stanley.


18th Aug 2011 4:01 pm
I was standing outside the photo-stat shop waiting to get a printout of my Morgan Stanley resume .. got a text message mentioning that the pre placement talk is about to start in the Additional Teaching Block(ATB). I didnt know but I had an idea that it would start around 5 pm but they started at 4, well so to speak the company was on time but I was not. So the running phase started right from that moment. I was late by 30 minutes in the PPT and missed most of the part.. found a seat in the last row of the hall and saw a very tall man standing on the main podium blabbering something which I couldnt make out may be because of the echo in the hall and you can say I couldnt understand a thing out of it ( and I really paid the price for it  :P ) .



Normally when a company visits a campus they give a PPT and then proceed with the written text that may include aptitude, technical and logical reasoning but there was something different about Morgan Stanley. The Executive Director of Morgan Stanley (Mumbai) gave the PPT and then instead of going through to written tests they offered some refreshments :P which was the SECOND different thing about them .. FIRST was that they were on time unlike other companies which visit the campus :).



The WRITTEN EXAM consisted of one Computer fundamentals section of 10 questions, one technical section of 30 questions and last logical reasoning section of 10 question, so in total 50 questions and 90 minutes. The THIRD different thing about Ms was they offered a choice in the technical section, you can opt for C, C++ or JAVA. The exam was pretty easy and one can easily attempt all the questions in those 90 minutes. The first section (of 10 questions) had questions from operating system, pre-order and post-order tree questions, time complexity of sorting algorithms and other gen. stuff. The second section i. e. the technical section in C had lots of output questions on pointers, unions and structures, gen function calls, pass by value and pass by reference etc and some theory related questions as well. They were easy and i was able to mark the answers just by analyzing the question. The third section ( ie the logical reasoning section  ) was pretty easy too! It had questions from speed and distance, one easy table type question of DI, probability etc.



After the written exam we saw the FORTH different thing about Ms :P They gave away Free Tshirts ( Black Color with "Morgan Stanley" written in white )and there were smiles all around :). Who doesnt love free stuff :P. After the test everyone dispersed and had dinner afterwards. People do all the analysis possible after such a easy test for example if the test was too easy then everyone can do it and that reduces your chance, if the paper was too difficult they might not have a chance to get though :P So basically mixed negative doubtful reactions from everyone depicting the uncertainty. While we were having these discussions the Ms people were busy selecting people who can clear the written test round. Approximately I would say out of 180 short listed candidates ( initially before the PPT on the basis of the Ms resume) lets say around 150 sat for the test and around 27 were the lucky ones to get through. It was really a big thing to get through because it was then I cleared my first written round in NITK.



I was excited, and it was then I started planning for the kill. I knew it was my first chance and somehow I have to convert it being confident, being myself without the hint of nervousness in my voice. I was afraid of the HR session even more than the technical section. They mentioned that there will be a group task, technical and HR interviews in the recruitment process from 8 am on 19th. I started digging in the questions MS asked in NIT Warangal and many of my friends contributed.




NIGHT BEFORE THE INTERVIEW:

HISTORY:
(Read the Morgan Stanley page on wikipedia for this! )
I found out the history of Morgan Stanley. checked out the wikipedia page, there is hell lot of information right from the year 1935 when the firm came into existence by the main founders Henry Morgan and Harold Stanley, found out the following information (check out the wiki)
* The story about why the founders started the firm. (They left JP Morgan to start their own because of the Glass Steagal Act in 1935).
*about the working of the company.
*their main business areas.
*The meaning of those investment terms ( which i came across studying for the last point ).
*what are they doing in India.
*what was their role in the recession 3 years back(- US govt. actually hired MS to take themselves out of recession).
*what is there role in the predicted recession in this year(MS predicted a recession in the coming months because of the ineffective working of leaders in US and UK but this recession will not be the same it was 3 years back, it will be a shallow recession because economic factors are good).
*Clients of MS.
*1999 management crises in MS and as a result they fired their CEO Philip Purcell in 2005.



GROUP TASK:

I got to know that even the group task was of a different kind. It was like to design a LOGO for the Morgan Stanley Technical division and give a Slogan for it, and the LOGO must match the virtues of MS.
So I started digging out the meaning of different COLORS which i can use in my logo to show the different virtues. I found out this:
Blue: Innovation, Ingenious, Integrity, hope, creativity.
Aqua Blue: Communication.
Skin Color/Pale Yellow: Neutral.
Bright Green: Uplifting.
Bright Red: Courage.
Bright Yellow: focus, vision
White: Simplicity.
Black: Power, authority.



TECHNICAL:

* OOPS concepts, Virtual functions (in C++) and more basic concepts.
*DBMS, I got to know there was a database design in the 2nd technical round.
* There was a puzzle also:
Ques. Design the classes for the working of a LIFT.
(Try to thing about it first !!! )
After a fair amount of discussion the following solution was proposed:
Lets assume there are 100 floors in the buildings
There is just one class and the data structure used is a doubly linked list!
((Initial solution was to use a array of 100 elements with an indicator associated with everyone of them to show that the button is pressed for that floor from the LIFT physical interface and the LIFT must start moving towards that floor and stop when it reaches the floor.
BUT then there was a lot of space wastage and we never set all the indicator variables at the same time)).
If you see a working of a LIFT, you can notice if initially the lift is on floor Zero and somebody press the lift call button on 5th floor so the the door closes and the lift start moving towards the 5th floor. Lets say when it just crossed 3rd floor a call was made from the 3rd and the 20th floor so what happens to the lift? The lift will keep going up till 20th floor and then come down on the 3rd floor. So what do we infer from it? Can I say the lift is moving like a head moves on a Disk using a LOOK or SCAN algorithm or a mix of them, like servicing all the calls in one direction (up) till the max call and then reversing its direction servicing others when the lift comes down.
So why doubly linked list came in the picture? The idea was to keep a sorted list of all the calls being made to the list to be serviced! Lets say the doubly linked list is like:
3-> 15 -> 35-> 48-> 99 ( you can say these floors have their indicators set )
and the current position of lift is 35 and the lift is going up. so first of all it will delete 35 from the list (stating that the lift reached floor 35 and moved on to the next request ie 48.
But lets say a call to floor 20 comes along as the lift is moving from 35 to 48 so the list will be :
3->15->20->48->99
and then the service sequence will be :
48 , dir : up
99, dir: up ( max serviced ! so dir reverse ! dir : down now ) current list : 3->15->20.
20, dir:down
15,dir:down
3,dir:down
and it comes to an halt on the 3rd floor.
so the Functions of the class can be :
1. Listener () - listening to all the calls made from outside the lift and adding them to the doubly linked list.
2.Halt()- to halt the lift
3.Dooropen()- to open the doors of the lift.
4.Doorclose() - to close the doors of the lift.
5.gen add and  delete functions to add and delete nodes from the doubly linked list.
6.methods connected to the physical outer interface ( forming the USER layer ).
Other variables used can be :
1.dir : specifying the direction of the lift.
So i think these must be the specifications of the class lift in my opinion. If you feel like i have left something feel free to mention it in comments or else let me know if you can think of a different solution :)


Well that was pretty much what i studies the night before the interview. The interviews were scheduled to start at 8am next day. So i decided to sleep around 2am till 6am and the D day was there !! :)

Morgan Stanley Interview Process

19th August 2011, 6:00 am
The day started with a sudden sense of excitement and fear :) I thought i will go through my projects once but couldnt because there was no time. I got ready, prayed to God and left hostel for Training and placement dept with my Roommate ( who go in also :) ). When i was about to enter the dept a small drop of water fell on my forehead from the shed outside the dept, rain water , I just smiled and thought it as if it was like a blessing from the heaven :) . We reached there around 7:45 am and the company people were already there and waiting for someone to open the department (They were on time for the the third time ! ).
They collected our MS resume and went in for a discussion to allot candidates to the panel for the first round of technical interview.


1st TECHNICAL INTERVIEW ( Duration: 45 mins approx,one interviewer):
The first interview was pretty simple and they asked just the basic questions like:
(since i chose to write a C technical paper in the written round, i had to give the interview for C,C++ language but you can choose to change it if you need!).
Ques 1. Write the functions to implement a queue using a array.
So, i wrote both enqueue and dequeue with respective overflow and underflow conditions.
He suggested what if the queue should never overflow unless you run out of memory ?
Its like growing the queue towards the rear side infinitely so i could only suggest one solution:
creating the queue as a linked list where we can delete node elements from the front ( where in array memory will be lost forever if we move the front ) and then we can grow the linked list from the read side as much as we want.
but there can be an another solution as well :
using realloc() we can actually give more memory to the array where the earlier elements remain as it is.


Ques 2. PUZZLE: There is an array with elements from 1 to some integer 'n' and one of those numbers is being over written by some other number in the sequence like:
for n=3 array should be 1,2,3
but actually it is 1,2,2 where 2 was copied over 3.
So the question was to determine the missing number.
As i approached the question i saw that the problem can be simplified if the array is sorted.
So i asked if i can assume the array is sorted and he said yes lets assume it is.
at that time i can think of two solutions:
a. lets  say the array is like 1,2,3,4,4,6,7,8 for n=8
you can compare consecutive array elements to  find if we get a duplicate. This can be done O(n) time.
b. Lets take the same array as above and use a Divide and Conquer approach.
ie lets find the middle index 'x' of the array and compare the value of index x with value at index x+1 and x-1. If we can find consecutive numbers we are done! else we divide the array into two left and right array and continue to do the same until we have 3 elements in an array. This approach will take O(lg n) time.
But what if the array is not sorted! My friend suggested that we can find the product of 1 to n array elements and that will be (n! ) ie n factorial and we can find the product of the actual array given, lets say 'P' Then when we divide (n! /P) the numerator will give the missing number and the denominator will give the repeated number. This approach will again take O(n) time in execution.


Ques 3. There were questions on OOPS(General definitions), pointers.


Ques 4.Difference between calloc() and malloc()
ans :
a. calloc initialize the allocated memory with 0(zero) while malloc just fill it with garbage.
b. calloc takes the number and type of data as arguments while malloc takes the number of bytes.
c. calloc may or may not allocate contiguous memory locations but malloc always allocate contiguous memory locations.
Please suggest if you know more.


Ques 5. What is the difference between Static and a global variable in c.
ans:
a. static variables local to the block are initialized only once for recursive calls.
b. static variables remain in memory till the program in execution exits but cannot be used outside its scope where as global variables are global in scope and can be used anywhere.
I think initial questions took more time and rest were easy. There was a catch that different panels were asking different questions and puzzles so this information is just about one panel. My interview went well overall.


First round of technical interview ended around 10 30 am and they marked it as a elimination round, at 1 pm when they announced the results out of 27 people (who cleared the written) only 15 went through to the other rounds for further process. My name was second on the list but i dont know if they ordered it according to some score or just like in a random order.
 
Anyways in another 30 minutes they gave us a FORM to be filled which had the following questions:
1. Why do you want to join morgan stanley?
2. Are you willing to relocate to mumbai ?( if applicable)
3. Tell us about your technical/ business projects.
4. Tell us about your interests and hobbies
5. Mention if you read any books/ magazines.
6. Do you hold an offer from any other company? YES or NO.



And then it was followed by a very interesting GROUP TASK.
It was not a group discussion but a group task. Let me tell about it in detail.
There were 8 people in the group and there were 8 printed sheets with rough sheets, pastel colors, some wooden cuboid shape blocks and white board markers on the table.
The printed sheet stated :
You have to design a LOGO and write a Slogan and a marketing strategy for the Technology division of Morgan Stanley. The logo must comply with the virtues of the company as:
*integrity
*ownership
* being a leader
*work life balance
(there was one more which i dont remember now )
there was also a condition that if you dont make anything you will be disqualified from the selection process.


GROUP TASK 1st ROUND ( Duration : 15 mins):
This was individual level round where all the 8 people read the question ( the question was of full 1 A4 sheet ) and design a logo and think of a slogan and marketing strategy.
My design was a M with a tilted S joined to M ( like a italic S with M ) with a globe balanced on the S.
I filled the globe with blue and green color ( according to my home work it shows integrity and uplifting )
Wrote MS with bold lines to show ownership and colored M alphabet like it is wearing a jacket to show the charisma of a leader using a purple color.
the border or the logo was bright logo showing vision and innovation.
and my slogan was : put clients first/one client at a time ( for which my logic was that the firm wont exist without clients ! ).
and somehow i forget about the marketing strategy :P may be i skipped it while reading the question itself :P
They gave like only 10 minutes for the round saying that we have to cut the deadlines in the industry many a times :P. 


GROUP TASK 2nd ROUND (Duration : 20 mins):
They made two groups of 4 people and we were again given 20 minutes to do the same job. They were observing us very closely, listening to every word you say there. I presented my logo,slogan and the reason behind it to the three other people in the group and then asked for what they did in the last round.
One guy just wrote MS++ as the logo with ++ meaning we are moving forward. One guy made a logo filled with Acronyms but he also gave a acronym COMBINE with all the alphabets meaning something which later became the marketing strategy. The last guy tried making a logo with those cuboidal wooden blocks but was just like that. The round ended in like 15 minutes or so and not after 20 minutes as told before.


GROUP TASK 3rd ROUND(Duration : 20 min):
They made all the 8 people in the room discuss about the Logo, slogan and the marketing strategy. This was the time when actually noticed that there was actually a marketing strategy to be decided. I presented my logo and mentioned how i incorporated all the virtues in my logo which other people didnt really think about it. We spent some time on the logo then moved on to slogan, we had many ideas and it was truly an interactive session. 6 out of 8 people were talking like anything and being intelligent we were able to reach a conclusion on logo, slogan and the marketing strategy. This round actually went on even after 20 minutes.

After the 3rd round they made us sit silently for some 10 minutes (not touching any paper on the table) while they were writing about on our sheets. Then they asked us to present whatever we decided on . I presented the logo which was a little different than what i designed and did show off some of my knowledge of MS total revenue and net profit which doing so.

In the end they asked us questions like:
a. How was it while you were working in the group of 4?
b.Do you think you all compromised to reach the conclusion?
c.They asked individually if you think you would like to change anything ?
d.They asked if you can make it any better what would you do ?
Then they asked us to leave. It was an hour and 15 minute of a real interactive session and my throat was really parched after it:P
Then we thought after such a group task they might just let go of the 2nd technical round and just eliminate people and send the rest for the HR but they were up for a 2nd technical round! and what hell mind bending experience it was !



2nd TECHNICAL ROUND:
I just thought .. just be calm and get it over with but it was not actually a very light thing but to test your patience and your way of thinking in the real way. Questions were such which you will never see in a normal exam or which you will never expect before sitting for a company. First question was pretty simple "Are you a Sindhi?" :P haha .. Ok let me give you the questions :P

Question: Tell me what happens when after you  compile and run a C++ program ?
My answer: The source program is broken down into token and parse trees are formed for the expressions, actually called lexical analysis and then linker and loader comes into play. the compiler create a .obj file and then a .exe file is generated when we run the program.

Question:When we say #include<stdio.h> do you include all the file or just the functions used in your program?
My answer: I dont know why i was confused in this but i said that only the functions used in the programs get added to the code in the final exe, we had a lot of discussion and he tried to convince me by giving an example of late binding where the call to the function depend on the base class or the derived class function, so because of the dependencies we should include base class as well in the code and not just the derived class.
I argued can the compiler not deduce all the dependencies ( like one function depend on other function to do its work) and include all the functions used and the other functions on which they depend. In the end i have to say that "What i said earlier was wrong and what you said was correct".. he just replied with a " Its okay " :P ...


Question: PUZZLE : You have a Stack that can grow indefinitely and and infinite number of elements are getting pushed into it. There is a random event and when it occurs an element is popped from the stack and at that moment you have to find the minimum element of the stack. Tell me how will you go about it. algorithm is not needed.
( this question is just to check how do you think about the problems at hand).
My answer:
I initially took a "min" variable that will store the min of the stack at any time and everytime a new element is added it will be compared to the minimum and accordingly the value of min will be updated. So as a counter question he asked if you can find the disadvantages of this approach. I found out "what if the element to be popped out is the minimum element?" we will loose the minimum of the stack. So, why dont we keep last n minimum for N minimum of the stack. its like creating another inifinite stack and pushing the minimum value in it everytime a new element is pushed into it. So whenever a random even occurs " and element is popped from both the stacks" and then the element at the top of the 2nd stack will be the minimum element then.
Still the stack uses infinite space. please suggest a better approach than this if you can.
Let say :
a.
Stack 1 : 5
Stack 2:5
b.
Stack 1: 5 ,2
Stack 2:5,2
c.
Stack 1:5,2,6
Stack 2: 5,2,2
d.
Stack 1:5,2,6,7
Stack 2:5,2,2,2
e.
Stack 1:5,2,6,7,1
Stack 2:5,2,2,2,1
There was a issue of syncronization also as in when are you checking the minimum ie before or after the random event. So i said we can use "Syncronized" key word for the stack access but he asked me " Do you want me to take an interview in java ? " to which i politely denied :P . So in C++ we can have semaphores and he asked about difference between mutex and semaphore and if mutex is a semaphore.


Question: Dynamic memory allocation
If we write:
int* ptr=new int;
ptr++;
the code as we know will access a illegal memory access but can the compiler know it at compile time ?
My Answer:
I argued : if we write int *ptr=new int[n];
then do a ptr ++;
Then the value "n" must be taken as input from user at runtime and until that value is known new cannot assign a memory address ( if it doesnt fail ) to the ptr and only after that ptr++ will be an illegal memory access. So there must be a genralization of everything so the statement in the question must also detemine a illegal memory access on runtime only. Also since new allocate memory at runtime the illegal memory exception will be thrown at runtime only.
But then he argued since the compiler knows that (if at all) the new operator will allocate memory of just 2 bytes to ptr so can it not know that there is a illegal memory access at compile time ?
There was a lot of discussion on this point and i literally got him confused :P to which he said "You are confused and you are confusing me as well" to which i said " No sir i m not confused ! " haha :) I later said yes since size of int is known to the compiler at compile time by some code optimization the compiler can actually detect a illegal memory access at compile time. 


Question: How does the compiler distinguish the call to the overloaded functions ?
My Answer: lets say there is a function void abc(int,int) and void abc(float) then when the program is compiled the compiler actually change the name of the functions, as in the 1st function name will be like abc_int_int and second function name will be like abc_float to distinguish between the two and this naming process is called name mangling ( i think ! ).


Question:PUZZLE: There is a infinite while loop with a statement like int *temp=malloc(some_bytes); in it.
So when you run this program the system will ultimately run out of memory and the program will stop.
So if you have two systems with 1 GB memory and a 2GB memory on which one the program will run out of memory first ? assume there are no other processes running.
( the question actually demands that you find constraints ( whatever) under which the system will run out of memory in the 1 GB system )
My answer:
I said if the program is running under a JVM environment, it depends how much memory is allocated to the JVM and it will not depend on the memory of the system ( WHICH WAS WRONG BECAUSE YOU CANNOT ALLOCATE MEMORY USING MALLOC IN JAVA). He again said " Do you want me to take your interview in java ?" :P To which i politely declined again ! so he asked what will happen in c++ ?. Since the end result of a c++ is a .exe file so the operating system must allocate mermory.
The second constraint that came to my mind was then concept of User Memory and System Memory. it will depend on the system which has a smaller user memory, which ever has will run out first since the user program will execute in user memory only, to this he said lets say operating system takes zero memory then answer the question.
 said 1 GB will run out first.
He again said you have studied Computer architecture try thinking in that direction.
The third constraint i could think of the RAM .. which ever system will have a smaller RAM will crash first since secondary memory cannot play any role in the program execution.
He literally asked then " can you think of any more constraints to answer the question?"
I said " no nothing else is coming to my mind right now".
Well this was the end of the technical interview. I asked him " how was my performance?" to which he answered "that you will get to know in the evening" ( with a smile :) .
I came out of the room all drained out and my friends told me mine was the longest interview till now .. almost one and half hour! even i was amazed ! I just sat there for like 15 minutes and i was called for the HR round and the Executive Directorhe (literally 7 ft tall)  was there to tke my HR :P ( which i didnt know then :P ) 




HR Interview ( Duration : 30 minutes )
He started by asking about the software development cycle, all the seven steps
1. Requirement gathering
2.Requirement analysis ( he asked what tools would you use for this ! meetings and Questionaires )
3.Design ( he asked what tools you will use for this ! DFDs and ERDs)
To which he asked what do you think comes first design or architecture ?
I said design comes first to which he argues shouldnt the architecture come first ? like you create a blue print of the home and then create it ? is it not like that ? I dont know what i answered for that ! :P
He then asked what is a DBMS?
At this point i was confused if this was a HR round or a 3rd technical round !! anyway i answered what a DBMS is .
He again asked what is Relational Database ?
I told him the definition of a relation and then i dont know why i said " i dont know", my mind was not working at all !
He asked me about my projects. I stated all of them except my java speech to text and text to speech convertor to which he asked have you not done any object oriented projects ? then i said yes i did one in java too! but he was not really interested in the content of the projects ( in total nobody asked about what i did in the projects ).
Then he started with the real HR ! 

Q.  Who do you think is a leader ?
Answer : i was really prepared for this one !! i chose 3 leaders and stated their qualities real well to show all the qualities of a leader ie charisma, inspiration ,innovation , will power, pointing to the right way.


Q. what is a difference between a leader and a manager ?
Answer: i said a leader is someone which points its followers in the right direction and inspire them to innovate and work well whereas a manager is someone who manages resources. A leader can or i should say should be a manager but a manager may not be a leader always. 


Q. Do you think you are a leader ?
Answer : I can be a leader if the situation demands me to . If there is a dire need that i should stand up i will ! 


Q. Why Morgan Stanley?
Answer: I studied a long history of MS last night so i just threw it all up saying that i think i will get more opportunities in future since MS is such a well reputated firm, when i entered NITK i found myself among people with so diverse thinking and now if i join you i will get a chance to meet even more technologically diverse people which i think which be a good exposure.

Q. What motivates you ?
Answer: I said my curiosity to gain more and more knowledge and gave an example how i started loving economics when i studied it in my grad college.


Q. Where do you see yourself after 5 years ?
Answer: i said diplomatically that i dont really care about what profile you are offering me, till now i have done just so small level projects and i have no experience so when i join a company i know i will get to learn more and more  so even after 5 years i think i will just be learning and there is no upper limit to learning :)
( i dont know i think he repeated this question ! )


In the end he asked me if i have any questions to which i asked him ( my bad luck ! i was asking because i wanted to sound curious :P )

Ques. Tell me something about the work culture of the company ?
 He questioned me back ! Were you not there in the PPT last evening ? i discussed everything !
And i was actually not there so i just apologized and said that was my bad :P remember i was half and hour late and still couldnt understand a word because of the echo :P anyway he answered my question.
i again asked 

Ques. Tell me about the technologies that i will be working on?
To which he again said you should have discussed the PPT part with your collegues even if you werent there ! (i was like SHIT ! what the hell i m doing ! ) he anyways answered that as well !
i asked again ..
Ques. how it is to be a beginner in MS ?
( Ohh that was wrong again !) He again said you should ask your collegues about the PPT. i discuseed everything yesterday .
After 3 wrong questions i thought i should just say a thank you and get out :P and that is what i did :P 


After so much of drama and saying " i dont know " , " i was wrong "  and asking so many wrong questions :P i was having a very negative feeling that i may not get in  .. there were 15 people till the last round and it was like they might just select 7 at max. I was roaming around in the campus with my friends after being drained out of life ! :P and then i was just about to return to my Hostel Room I got a call that made my heart go easy ... I was selected ! along with my roommate Vijay :)