Rejected a Program Manager Position at Microsoft Dublin - My Successful Interview at Microsoft | Svetlin Nakov's Blog



Rejected a Program Manager Position at Microsoft Dublin – My Successful Interview at Microsoft | Svetlin Nakov's Blog

Interview Questions @ Microsoft Dublin

I had 5 interviewers asking me lots of software engineering questions. The questions were very adequate for the team leader position that was my objective (“program manager” position in Microsoft is a senior technical position, like a team leader in a typical software development company). Interviewers were not just asking me to explain some technical concept or propose a solution to some real-world problem. They gave me a blackboard to write some code in order to see how I am attacking the problems, what types of pictures I draw, how exactly my thinking flows, etc.

I remembered most of the interview questions and the answers I gave. I hope my answers were good because I was approved and the recruiter from Microsoft sent me a job offer few days after the interview. Below are the questions with my answers:

Interview Question 1: You need to architecture the security for a bank software. What shall you do?

There is no exact answer here. This question is about thinking: follow the existing standards in the banking sectors, establish global security policy, secure the network infrastructure, secure the application servers, secure the databases, establish auditing policy, securing the operators’ workstations, secure the Internet and mobile banking portal, etc. Think about authentication (smart cards), authorization, secure protocols, etc.

Interview Question 2: You are given a string. You want to reverse the words inside it. Example “this is a string” –> “string a is this”. Design an algorithm and implement it. You are not allowed to use String.Split(). After you are done with the code, test it. What will you test? What tests will you write?

I knew an elegant solution in 2 steps:
1) Reverse whole the string char by char.
2) Reverse again the characters in each word.
You need to write a method Reverse(string str, int startPos, int endPos).
To test this method test normal cases first (middle of the word, beginning of the word, end of the word, 1 character only, all leters in the string). Check bounds (e.g. invalid ranges). Test it with Unicode symbols (consisting of several chars). Perform stress test (e.g. 50 MB string).
Write a method ReverseWords(string s). Test it with usual cases (few words with single space between), with a single word, with an empty string, with words with several separators between. Test it with string containing words with capital letters.

Interview Question 3: What is the difference between black box and white box testing?

Black box testing is testing without seeing the code. Just looking for incorrect behaviour.

White box testing is about inspecting the code and guessing what can go wrong with it. Look inside arrays (border problems), loops (off by 1 problems), pointers, memory management (allocate / free memory), etc.

Interview Question 4: What is cross-site scripting (XSS)?

In Web application XSS is when text coming from the user is printed in the HTML document without being escaped. This can cause injecting JavaScript code in the client’s web browser, accessing the session cookies, logging keyboard, and sensitive data (like credit card numbers).

Interview Question 5: What is SQL injection?

SQL injection is vulnerability comming from dynamic SQL command text created by concatenating strings with an input comming from the user, e.g. string cmd = “SELECT * from USERS where LOGIN='” + login + “‘ and PASS='” + password + “‘”. if username has value “‘ OR 1=1 ‘;”, any login / password will work. To avoid SQL injection use parameterized commands or at least SQL escaping.

Interview Question 6: What is the most challengeable issue with multithreading?

Maybe this is the synchronization and avoiding deadlocks.

Interview Question 7: Explain about deadlocks. How to avoid them?

Deadlock arise when 2 or more resources wait for each other. To avoid it, be careful. Allocate resources always in the same order.

Interview Question 8: Do you know some classical synchronization problem?

The most important classical problem is “producer-consumer“. You have several producers and several consumers. Producers produce some kinf of production from time to time and consumer consume the production from time to time. We have limited buffer for the production. When the buffer is full, producers wait until space is freed. When the buffer is empty, the consumers wait until some producers put something inside.

Practical use of the producer-consumer pattern is sending 1 000 000 emails (production) with 25 working threads (consumers).

Interview Question 9: You need to design a large distributed system with Web and mobile front-end. Through the Web customers subscribe for stock quotes (choosing a ticker and time interval) and get notified by SMS at their mobile phones about the price for given tickers and the requested intervals. A web service for getting the price for given ticker is considered already existing.

Use 3-tier architecture (ASP.NET, C# business tier, SQL Server database). Use a queue of tasks in the business tier and a pool of working threads (e.g. 100 threads) that execute the tasks. A task has 2 steps (query for the ticker price and send SMS). These steps are executed synchronously (with reasonable timeout).

We have another thread that performs SQL query in the database to get the subscriptions matching the current time and appending tasks for SMS notification.

We consider the SMS gateway is an external system.

Interview Question 10: How you secure the stock quote notification system?

We need to secure all its parts:
1) The user registration process – need to verify phone number with confirmation code sent by SMS. Need to keep the password with salted hash. Need to keep the communication through HTTPs / SSL.
2) The application server with business logic. Secure the host, put reasonable limitations to avoid flooding the server.
3) Secure the database (e.g. Windows authentication without using passwords).
4) Secure the network (e.g. use IPSEC)
5) Secure the access to the Web service (WS Security).
6) Secure the mobile phone (e.g. sending encrypted SMS messages and decrypt them with a proprietary software running on the phone).

Interview Question 11: How you write a distributed Web crawler (Web spider)? Think about Windows Live Search which crawls the Internet every day.

You have a queue of URLs to be processed and asynchronous sockets that process the URLs in the queue. Each processing has several states and you describe them in a state machine. Using threads with blocking sockets will not scale. You can still use multiple threads if you have multiple CPUs. The Web crawler should be stateleass and keep its state in the DB. This will allow good scalability.

A big problem is how to distribute the database. It is very, very large database. The key here is to use partitioning, e.g. by site domain. Take the site domain, compute a hash code and distribute the data between the DB nodes based on the hash code. No database server can store all the pages in Internet, so you should use thousands of DB servers and partitioning.

Interview Question 12: You have a set of pairs of characters that gives a partial ordering between the characters. Each pair (a, b) means that a should be before b. Write a program that displays a sequence of characters that keeps the partial ordering (topological sorting).

We have 2 algorithms:
1) Calculate the number of the direct predecessors for each character. Find a character with no predecessors, print it and remove it. Removing reduces the number of predecessors for all its children. Repeat until all characters are printed. If you find a situation where every character has at least 1 predecessor, this means a loop inside the graph (print “no solution”). Use Dictionary<string, int> for keeping the number of predecessors for each character. Use a Dictionary<string, List<char>> to keep the children for each character. Use PriorityQueue<char, int> to keep the characters by usign their number of predecessors as priority. The running time will be O(max(N*log N, M)) where N is the number of characters and M is the number of pairs.
2) Create a graph from the pairs. Use recursive DFS traversal starting from a random vertice and print the vertices when returning from the recursion. Repeat the above until finished. The topological sorting will be printed in reversed order. The running time is O(N + M).

Interview Question 13: You are given a coconut. You have large building (n floors). If you throw the coconut from the first floor, it can be broken or not. If not you can throw it from the second floor. With n attempts you can find the maximal floor keeping the coconut intact.

Now you have 2 coconuts. How many attempts you will need to find the maximal floor?

It is a puzzle-like problem. You can use the first coconut and throw it from floors: sqrt(n), 2*sqrt(n), …, sqrt(n) * sqrt(n). This will take sqrt(n) attempts. After that you will have an interval of sqrt(n) floors that can be attempted sequentially with the second coconut. It takes totally 2*sqrt(n) attempts.

Interview Question 14: You have 1000 campaigns for advertisements. For each of them you have the returns of investments for every day in a fixed period of time in the past (e.g. 1 year). The goal is to visualize all the campaigns in a single graphics or different UI form so the user can easily see which campaigns are most effective.

If you visualize only one campaign, you can use a classical bar-chart or pie-chart to show the efficiency at weekly or monthly basis. If you visualize all campaigns for a fixed date, week or month, you can also use classical bar-chart or pie-chart. The problem is how to combine the above.

One solution is to use a bar for each campaign and use different colors for each week in each bar. For example the first week is black, followed by the second week, which is 90% black, followed by the third week which is 80% black, etc. Finally we will have a sequence of bars and the most dark bars will shows best campaigns while the most bright bars will show the worst campaings.

I knew that I was approved even at the interview. It was a good sign that the manager of the development in Microsoft Dublin for the Windows Live platform Dan Teodosiu personally invited me in his office at the end of the interview day to give me few additional questions and to present me the projects in his department. Dan is extremely smart person – PhD from Stanford University, technical director and co-owner of a company acquired by Microsoft few years ago. It was really pleasure for me to meet him.

There were 2 teams in Dublin that wanted to have me onboard: the edge computing team working on Windows Live and the Office Tube team working on video recording and sharing functionality for the Microsoft Office. I met the manager of the Office Tube team at the end of the interview day to discuss their products and development process.


Read full article from Rejected a Program Manager Position at Microsoft Dublin – My Successful Interview at Microsoft | Svetlin Nakov's Blog


No comments:

Post a Comment

Labels

Algorithm (219) Lucene (130) LeetCode (97) Database (36) Data Structure (33) text mining (28) Solr (27) java (27) Mathematical Algorithm (26) Difficult Algorithm (25) Logic Thinking (23) Puzzles (23) Bit Algorithms (22) Math (21) List (20) Dynamic Programming (19) Linux (19) Tree (18) Machine Learning (15) EPI (11) Queue (11) Smart Algorithm (11) Operating System (9) Java Basic (8) Recursive Algorithm (8) Stack (8) Eclipse (7) Scala (7) Tika (7) J2EE (6) Monitoring (6) Trie (6) Concurrency (5) Geometry Algorithm (5) Greedy Algorithm (5) Mahout (5) MySQL (5) xpost (5) C (4) Interview (4) Vi (4) regular expression (4) to-do (4) C++ (3) Chrome (3) Divide and Conquer (3) Graph Algorithm (3) Permutation (3) Powershell (3) Random (3) Segment Tree (3) UIMA (3) Union-Find (3) Video (3) Virtualization (3) Windows (3) XML (3) Advanced Data Structure (2) Android (2) Bash (2) Classic Algorithm (2) Debugging (2) Design Pattern (2) Google (2) Hadoop (2) Java Collections (2) Markov Chains (2) Probabilities (2) Shell (2) Site (2) Web Development (2) Workplace (2) angularjs (2) .Net (1) Amazon Interview (1) Android Studio (1) Array (1) Boilerpipe (1) Book Notes (1) ChromeOS (1) Chromebook (1) Codility (1) Desgin (1) Design (1) Divide and Conqure (1) GAE (1) Google Interview (1) Great Stuff (1) Hash (1) High Tech Companies (1) Improving (1) LifeTips (1) Maven (1) Network (1) Performance (1) Programming (1) Resources (1) Sampling (1) Sed (1) Smart Thinking (1) Sort (1) Spark (1) Stanford NLP (1) System Design (1) Trove (1) VIP (1) tools (1)

Popular Posts