Skip to content
Related Articles

Related Articles

Microsoft Interview | Set 10

View Discussion
Improve Article
Save Article
  • Difficulty Level : Easy
  • Last Updated : 10 Jan, 2019

Written Test
It was online test which contains 20 MCQs on C & C++.

The coding round had two questions.

  1. Given some text lines in one string, each line is separated by ‘\n’ character. Print the last ten lines. If number of lines is less than 10 then print all lines.
  2. Do the level order traversal of complete binary tree.

      2    3
    4  5  6  7 

    Print it as
    2 3
    4 5 6 7

Technical Round 1

  1. First he asked me to tell him about any project which I have worked on.
  2. Given an array of integers. Find consecutive elements in array which has maximum sum. I know the solution to this problem so I told him quickly.
  3. Next he modified the question and asked me to find consecutive elements in array that have sum equals to zero. Taking some time, I told the answer to this question also.
  4. Next he modified question again and asked me to find consecutive elements in array that have sum close to zero, given that there is no sub array with sum equals to zero. Also write test cases for it.

Technical Round 2

  1. Given a linked list. How will I detect whether the list has cycle? Also write test cases for it.
  2. He then asked me whether I have some knowledge of graphics programming. He asked me how I will implement ‘floodfill’ for graphics application. Write code and test cases for it.

Technical Round 3

  1. Given a 2D array and a key value. Search this key value in array and turn all elements in row and column of this key to zero.
  2. Given a sorted array of size n. Each element in array is unique and lies from 1 to n+1. Find the missing element. Write code and test cases for the same.
  3. How will I keep track of number of visitors visited my web page?

Technical/HR Round 4

  1. Given a string. Find a character with most number of occurrences. Write code and test case for same.
  2. Why I want to join Microsoft?
  3. What’s the most challenging task I did in my graduation life?


I would like to thanks geeksforgeeks team for this wonderful site which helped me a lot and without which I would not be able to crack this interview.

This article is compiled by Akash Gupta. Many Many congratulations to Akash Gupta. If you like GeeksforGeeks and would like to contribute, you can also write an article and mail your article to See your article appearing on the GeeksforGeeks main page and help other Geeks.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!