Microsoft internship written test

Here in Belgrade, Microsoft has its development center. During the entire year, they have open positions for internships. [clicky]. I heard some positive talks from senior colleagues from the university and their general satisfaction with the time spent there while on their internship, so I though I might give it a try. I wanted to experience whole process first-hand and in the end, try and get the offer and perhaps learn something new and useful, that would help me in the future. Also, being accepted by a Microsoft is not a small thing, and that reference could also mean a lot for my further career. So with that in mind, I applied and soon got an invitation for a written test.

I though I fulfilled most of the requirements mentioned on the website, so there were no problems in that part. The problem was I had no idea what to expect at the test and for the interviews, so my quest first began by asking people that went through entire process for their opinions and suggestions how to prepare for those.


One of the most useful texts about entire application process that I found was at the Nenad Bozidarevic’s blog: Utisci sa testa za praksu u Microsoft-u (Serbian-only). It gave me an insight of the kind of problems that are chosen for the test and the overall expectations for the one’s knowledge and programming skills. I soon found out about two great (excellent, must read!) books for preparing interviews:

  • Cracking the Coding Interview (5th edition | Gayle Laakmann McDowell)
  • Elements of Programming Interviews (Adnan Aziz, Amit Prakash, Tsung-Hsien Lee)

Both books are filled with carefully chosen questions from all kinds of programming areas: strings, arrays, linked lists, bit operations, sorts,… Also, both books talk about necessary preparations for the interview, but for the test, it’s more important to focus on questions and problems, and once you got an invitation for an interview, then it’s time to worry about the rest. So, focus on questions, cover areas that you think you are most unfamiliar with, and if you don’t have much time to prepare, then at least read problems and learn the strategy for their solving, because it’s more important that you understand the concept of the solution, than is to know exact code required.

Two other very helpful websites where you can find a lot of helpful information about companies that you’re applying to and questions from interview are: CareerCup and Glassdoor.


Now, once I was prepared with knowledge about hiring process and what to expect, I went to the written test. The test has 7 questions in total, and is divided into 3 categories. Easy programming questions, “hard” programming questions and math problems.

  • Easy programming (3 Qs): these problems are not hard to code, they are usually just time-consuming and are a proof that you posses a general programming knowledge. You need to do at least 2/3 to be considered as a candidate for an interview.
  • Hard questions (2 Qs): these problems require you to write an optimal solution. They are not hard, just require some tricks up in your sleeve. These questions are often found in the books that I mentioned, so if you went through those carefully, you probably won’t have too many problems with these questions either. These problems also tend to require a lot less code to be written and more focus on your problem-solving skills and advanced programming tricks.
  • Math problems (2 Qs): various math problems. There’s a non-written rule that one problem is about math probability. These don’t require any kind of advanced math (though it may help) but focus more on your logic and try to test your thinking. I would easily classify these as logic questions, rather than math problems.

And this is what came on the test that I was doing (well, most of it):

  • Write a function that outputs all possible angles between an hour-hand and a minute-hand on the clock, assuming that both hands move discretely.
  • Write a function that simulates NxN matrix shift in any direction like that found in the game 2048.
  • Ant traversal. (forgot big part of the problem)
    • Write a function that outputs shortest path length between two given points in the traversal.
    • *forgot*
  • Write a function that test if any permutation of a certain string is found inside another given string.
  • You have a sorted array that’s been split at some point, and those two parts of the once-sorted array swapped places. Given such new array, design an optimal algorithm that searches for the given value.
  • Given are two functions, f(x) = x2 and g(x) = ex, in the [0,100] interval. Write a new function h(x), defined on a same interval, that has following properties:

    • h(x) doesn’t intersect neither f(x) nor g(x), but shares 100 points with f(x) and 100 points with g(x)
    • h(x) doesn’t intersect neither f(x) nor g(x), but shares 100 points with f(x) and 200 points with g(x)
  • There are two classrooms and a teacher. Probability that a randomly chosen pupil from the first classroom gives a correct answer to a question is bigger than 0.5. Probability that a randomly chosen pupil from the second classroom gives a correct answer is less than 0.5. Probability that a teacher answers correctly to the question is bigger than 0.5. Probability that a randomly chosen pupil from both classrooms gives a same answer to the question as the teacher did, is 0.5. Find a ratio between the number of students in those two classrooms.

You have 4 hours to do a test. It may sound enough, but once you start writing, you’ll soon realize that your grand idea of solving all problems and commenting the code is not going to happen (yeah, this sounds familiar to me). Stress, practical lack of time will have influence on you and you may end up panicking and screaming internally at yourself for not preparing more (I’m also familiar with this one too). I started solving third problem and finished first part of it in two hours. After realizing exactly how much time I spent on that part, I started being really nervous, but I quickly realized what I needed to do to do the rest of the test well (those are tips’n’tricks).

Tips n tricks

First category:

  • You have 4 hours to do a test. It won’t be enough to do an entire test (probably). Focus on doing at least 2/3 of those easy questions first.
  • Don’t hesitate. Write code even if it’s not so smart or well organized or if it’s a really poor quality. You need to write answers, and not worry if it’s pretty or not.
  • Code doesn’t need to work 100%. It’s the general concept that matters.
  • Spend very little time thinking about best way to solve problem. Write code, not much time to speculate how fast, or memory friendly your algorithm is.
  • Pick two that you would do for sure. Third is optional, so you may choose to spend your time on the rest of the test, instead of doing these simple questions in full.

Hard ones:

  • Remember! From the books! You probably came across that exact same problem in the book.
  • If you’re solving these, at least write some solution. Don’t leave entirely blank. At least write pseudo-code. Propose better solution, write about what you think that it can be improved, what bothers you and you think it could be better done some other way. This is the place to speculate.

Math/logic category:

  • It really isn’t about math. It’s about how you see a problem and the relations between the objects from problem. Think!
  • Draw, plot some graphs, connect the dots, speculate about different approaches. If you don’t come up with an exact solution, than try to express your flow of thoughts.
  • So, try different things!

It comes down to few things: write code, don’t worry if it’s pretty or super-optimized. Suggest several ideas, write at least something so they “get to know you better” and the way you think about problems. Don’t panic, just spend time on solving problems instead of worrying about the whole thing.

Wrapping up

Several candidates were contacted within the period of first two weeks after the test. My answer came on the third week after the test. I was called for an interview. Now interviews, that’s a whole another story and I’ll cover it up in some future post.

2 thoughts on “Microsoft internship written test

  1. Thanks a lot, it was very helpful!
    So, I had mine earlier today, so I figured I’d share with the rest of you my experience:

    The test (on our surprise) had 4 questions and lasted 3 hours.

    1.Check if two strings (could be different sizes) are isomorphic;

    2.Given an array and its size, make a N-ary tree represented as left-son-right-brother, with these conditions:
    – Odd values must have son(s), while even can not
    – Preorder traversal outputs initial array
    – first value in the given array is odd, and the last is even. If more than one exists, return any.

    3.Length of a given array is n=2^m. Find the period of repetition of characters (it has to be fully completed, if the last one is “chopped of” it doesn’t count)

    4.Given a Node** head (linked list) and indexA and indexB, rotate a linked list chunk between them (indexA and indexB node included), if the first node starts at index 1.

    As you can see, they are all relatively easy, which in my opinion is a bad thing, because I think MDCS staff would hardly rang candidates properly. But, I believe interview will clear things up, and if we are not called after this test, then better luck next time, I guess. :D

    I wish you all much luck on the exams (and hopefully interviews)! ;)

Leave a Reply

Allowed HTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>