Upload Button Icon Add office photos

Microsoft Corporation

Compare button icon Compare button icon Compare

Proud winner of ABECA 2024 - AmbitionBox Employee Choice Awards

zig zag pattern zig zag pattern

Filter interviews by

Microsoft Corporation Interview Questions, Process, and Tips

Updated 8 Mar 2025

Top Microsoft Corporation Interview Questions and Answers

View all 735 questions

Microsoft Corporation Interview Experiences

Popular Designations

557 interviews found

Interview Questionnaire 

5 Questions

  • Q1. Find the nth element in a tribonacci(a variation of Fibonacci) series. t(n)=t(n-1)+t(n-2)+t(n-3)
  • Ans. 

    Find the nth element in a tribonacci series.

    • Use recursion to solve the problem.

    • Handle base cases for n=0, n=1, and n=2.

    • For n>2, use the formula t(n)=t(n-1)+t(n-2)+t(n-3).

    • Return the value of t(n) for the given n.

  • Answered by AI
  • Q2. Given three sides of a triangle, find whether a triangle is right angled, isosceles, equilateral, scalene in nature
  • Ans. 

    Given three sides of a triangle, determine its nature.

    • Check if any two sides are equal to determine if it's isosceles

    • Check if all three sides are equal to determine if it's equilateral

    • Use Pythagoras theorem to check if it's right angled

    • If none of the above, it's a scalene triangle

  • Answered by AI
  • Q3. What are the products that I have used of Microsoft? Why I would like to join Microsoft?
  • Ans. 

    I have used Microsoft Office, Windows OS, Visual Studio, and Azure. I want to join Microsoft because of its innovative culture and impact on the tech industry.

    • I have used Microsoft Office for word processing, spreadsheet management, and presentation creation.

    • I have used Windows OS for personal and professional use.

    • I have used Visual Studio for software development.

    • I have used Azure for cloud computing and hosting.

    • I wan...

  • Answered by AI
  • Q4. He then asked me to rate myself on a scale of 10 in any of my favorite language
  • Q5. Questions based on testing was asked like how do you test your code for bugs

Interview Preparation Tips

Round: Test
Experience: It was an online round conducted by cocubes. It had about 15 questions and time allotted was 30 minutes.
Duration: 30 minutes
Total Questions: 1

Round: Test
Experience: Note: Only allowed language was C.
Duration: 60 minutes

Round: Behavioural Interview
Experience: The interview was scheduled at around 6:00 pm. It started with a brief intro by the interviewer followed by mine. He then asked some behavioral questions. What are the products that I have used of Microsoft? Why I would like to join Microsoft? He then asked me to rate myself on a scale of 10 in any of my favorite language. Questions based on testing was asked like how do you test your code for bugs.
He gave a scenario with details as follows:
Suppose you are given a tablet and you need to explain your great great grandfather the features of it so that he understands what you say and thinks it as a useful gadget. Assuming your grandfather has no idea about gadgets like mobile, computer etc.
He also asked me to mention my strength and weakness. No such algorithmic questions were asked in this round.

Round: Technical Interview
Experience: This was the last round.
It was a group coding round.We were made to sit around a round table with paper and pencil and the HR gave us two questions to code.

General Tips: The interviewer wanted a clean code with minimum cuts as possible. So I would suggest practice writing code on a piece of paper. Puzzles were also part of interview
Skills: c, trees, string, data structures
College Name: NA

Top Microsoft Corporation Software Developer Interview Questions and Answers

Q1. Buses Origin Problem Statement You have been provided with an array where each element specifies the number of buses that can be boarded at each respective bus stop. Buses will only stop at locations that are multiples of the bus stop they ... read more
View answer (3)

Software Developer Interview Questions asked at other Companies

Q1. Maximum Subarray Sum Problem Statement Given an array of integers, determine the maximum possible sum of any contiguous subarray within the array. Example: Input: array = [34, -50, 42, 14, -5, 86] Output: 137 Explanation: The maximum sum is... read more
View answer (42)

Interview Preparation Tips

Round: Resume Shortlist
Tips: Iterate it as many times as possible. get it reviewed by as many seniors as possible. Be precise in stating your works and achievements.

Round: Test
Experience: Aptitude material on the SPO website was sufficient. Shortlisting was done from a full fledged online test

Round: Group Discussion
Experience: I didn't prepare for any GD neither did face any.

Round: Technical Interview
Experience: Faced an online technical test. The company who hosted the test goofed up with the interface, so a lot of people wasted time over coding questions that could not be solved because of faulty interface. No request for retest was entertained. Shortlist was fixed on studying compile attempts, time devoted to various sections and other performance measures insensitive to the flaw.

Round: Interview 1
Experience: Ques 1: Given a compact data structures to store string sequentially: one byte stores length, l of the string; next l bytes contains the string characters.
Ques 2: Write a code to insert a given string in the ith place, making sure the DS is still compact.
Ques 3: Write tests to verify correctness.
Ques 4:How will you correct the parse tree for ((a+b)*c)/d? What all dat structures can you use.

Round: Interview 2
Experience: Ques 1: Given a function f that returns true/false based on whether the input string satisfies some criterion in C.
Ques 2: Write a function that verifies that all substrings of a given string satisfy the criterion in C.
Ques 3: You hand over n identical linked lists to n salesperson. After the day's work, these salesperson return back the lists. Merge these lists such that all insertions, deletions, updates are taken care of so that you can repeat this process for the next day.

Round: Interview 3
Experience: Told about myself, my interests, my work so far, my internship projects. Followed by a quick coding question.
int *p;p++
printf("%d", p);
int *f(){int q[12];return q;}
int *p= f();*p=23;
Whats the problem here?
Each interview ended with 'do you have any questions for us?'.

General Tips: Know about your course projects. Be clear with basic CS concepts like OS, compilers and databases Have sophistication in algorithms. Try to cooperate with SPO and make good use of their efforts. Start preparing as soon as possible. Try not to eat anything that might deteriorate your health during the placement. season. Develop priorities both sector and company wise.
College Name: IIT KANPUR

Top Microsoft Corporation Software Development Engineer Interview Questions and Answers

Q1. Given two words, find the similarity between them. You have to develop your own sense of similarity here. Normalize length of LCS by the total length of the string.
View answer (1)

Software Development Engineer Interview Questions asked at other Companies

Q1. Given an acyclic graph of a city where each edge represents a road in the city and each vertex represents an crossing. Write an algo to find out the minimum number of vertices at which a policemen will be kept so that all the roads are cove... read more
View answer (2)

Interview Questions & Answers

user image Anonymous

posted on 6 May 2015

Interview Questionnaire 

13 Questions

  • Q1. What is the difference between a thread and a process?
  • Q2. What is synchronization? Acquiring and releasing a lock etc
  • Ans. 

    Synchronization is the coordination of multiple threads to ensure they access shared resources in a controlled manner.

    • Synchronization is important in multi-threaded programming to prevent race conditions and ensure data consistency.

    • It involves acquiring and releasing locks, using semaphores, mutexes, or other synchronization mechanisms.

    • Examples include using synchronized blocks in Java or pthread_mutex_lock in C to pro...

  • Answered by AI
  • Q3. What is buffer overflow? Why does it happen? What is the effect of it? How can u prevent it? Write a code snippet where buffer overflow happens.( I wrote a strcpy where source was smaller than destination)
  • Q4. As I spoke something about canary variable he asked me about that. Make sure u do not just get words out of your mouth because you read it somewhere, If you do not know the meaning ,don’t mention it 
  • Q5. Symmetric and asymmetric cipher, pros and cons of each
  • Q6. Asked me about my final year project, I said we have not finalised the topic
  • Q7. Asked me what I like , what do I think I am good at?(answer expected was technical, not HR type)
  • Q8. This was a coding question, I had to give the algorithm, after he was convinced, I had to write the working code: Given a string like “aaabbbdddaccc” compress it IN PLACE . (Basically, run length encodin...
  • Q9. Difference between recursion and iteration, pros and cons
  • Q10. Write code for Nth Fibonacci number iteratively, what is the disadvantage of doing it recursively
  • Q11. Which is the longest code you wrote till now? Which is the toughest code you wrote till now?
  • Ans. 

    The longest code I wrote was a complex web application with over 10,000 lines of code. The toughest code I wrote was a machine learning algorithm for image recognition.

    • Longest code: Complex web application with over 10,000 lines of code

    • Toughest code: Machine learning algorithm for image recognition

  • Answered by AI
  • Q12. Given a binary tree, node structure has data, left, right and next ,where next of every node is NULL. Now you must make every next point to the immediate next node on the same level( as in next one on the...
  • Ans. 

    Connect each node to its immediate right node on the same level in a binary tree.

    • Use level order traversal to connect nodes on the same level.

    • Use a queue to keep track of nodes at each level.

    • Update the 'next' pointer of each node to point to the next node in the queue.

  • Answered by AI
  • Q13. How do you think a dictionary is implemented in a phone or whatever?
  • Ans. 

    A dictionary in a phone is implemented using data structures like hash tables or tries to efficiently store and retrieve words and their meanings.

    • A dictionary app on a phone may use a hash table to store words as keys and their meanings as values.

    • The app can use a trie data structure to efficiently search for words and provide autocomplete suggestions.

    • The dictionary may also include features like word pronunciation, sy...

  • Answered by AI

Interview Preparation Tips

Round: Test
Experience: Q 1) Given an unsorted array and a number N, find a tuple which has a difference of N. If it exists return true else return false.(We all assumed tuple to be any two numbers in the array, I used a hash map, so  O(N) time and O(N) space)Q2)Given a circular linked list, insert an element such that after inserting it, the linked list remains sorted.(Consider all cases, inserting in the beginning, end and middle, basically I wrote the insert function such that it creates a sorted circular linked list).Q 3)Given a binary search tree and a number N in the tree, at whatever level N exists in the tree (say k), of that level print the left most node.(Binary search tree property is of no use here, find the level of N in the tree ,say it is k, and then print the nodes at level k from root from left to right, when first node at k gets printed, stop printing, maintain a static or reference variable for the same .I did not get this one perfectly during the test, so that was the first thing I was asked in my level one interview!!)
Duration: 60 minutes

Round: Technical Interview
Experience: He scanned through my resume and asked questions, so make sure you write stuff about which youcan give at least some idea. I had mentioned about ciphers I had coded, so I was asked questions on network security. Some of the questions I was asked were1) What is the difference between a thread and a process?

2) What is synchronization? Acquiring and releasing a lock etc 

3) What is buffer overflow? Why does it happen? What is the effect of it? How can u prevent it? Write a code snippet where buffer overflow happens.( I wrote a strcpy where source was smaller than destination)

4) As I spoke something about canary variable he asked me about that. Make sure u do not just get words out of your mouth because you read it somewhere, If you do not know the meaning ,don’t mention  it 

5) Symmetric and asymmetric cipher, pros and cons of each.

6) Asked me about my final year project, I said we have not finalised the topic.

7) Asked me what I like , what do I think I am good at?(answer expected was technical, not HR type)

8) This was a coding question, I had to give the algorithm, after he was convinced, I had to write the working code:

Given a string like  “aaabbbdddaccc” compress it IN PLACE . (Basically,  run length encoding, but elements that occur once you do not have to mention their count, as in abc remains abc )

Round: Technical Interview
Experience: 1) Difference between recursion and iteration, pros and cons

2) Write code for Nth Fibonacci number iteratively, what is the disadvantage of doing it recursively.

3) Which is the longest code you wrote till now? Which is the toughest code you wrote till now?

4)Given a binary tree, node structure has data, left, right and next ,where next of every node is NULL. Now you must make every next point to the immediate next node on the same level( as in next one on the right). Convert every level of the binary tree into a circular linked list (populate all the next pointers) Do not destroy the binary tree while doing this, tree structure must be retained.(I came up with an algo of using an array of node pointers, size of array equal to height of the tree something like that. after he was convinced, I had to write the working code, after which I was asked to consider some test cases etc)

5) How do you think a dictionary is implemented in a phone or whatever?

(using a trie , I did not know the name trie , but explained the possible structure which turned out to be a trie! )

Round: Technical Interview
Experience: A single question was asked but he asked it in different modified ways to check if could handle all the ways.Given a binary search tree, and a number N, return true if there exists a path in the BST which sums up to N. Otherwise return false.(Not necessarily a root to leaf path, any path)( I gave an n square solution)

Then he told to print the path without using an auxiliary array instead of returning true or false.

Then he asked me to store the start and end pointers of that path

Then he was like if I have given you a start and end node, just print that path.(I used the BST property here)

Round: Technical Interview
Experience: 1) Asked about my TGMC project (as it was mentioned in my resume) and my role in it.2) Given a linked list, alternate every two elements. (I gave the algo , then wrote the working code .My code had repeated if else fragments, so it was too long to read, so he asked me to reduce the redundancy, after which I was asked about test cases)3) Given an unsorted array, store in the beginning of the array, one occurrence of every 

element in the array,(basically a set form of the array)

Input:1,6,7,3,5,2,7,3,1,6

Output:1,6,7,3,5,2  no importance given to what happens to the remaining part of array!! (Order of elements in output is not important, I suggested using built in SET which he did not allow, so I suggested sorting the array and proceeding, I was asked to write the working code)4) Given a table having names and phone numbers, print all erroneous phone numbers.(I suggested making a regular expression for all possible phone patterns and check each entry with the regular expression. i gave examples of invalid phone numbers)

General Tips: Do not fake something if you do not know it, be honest 2) If you are unable to handle certain test cases it is okay, but then if you yourself point outthe bugs and the cases which have not been handled, leaves a positive impact.3) Remain calm and confident because the interviewers are cool and friendly.4) It is okay to give slightly wrong answers at times, because when they know you are closeto the correct answer, they push you to get it right. They know when to help and get itout from you.5) No HR questions were asked , but just have some background about the company, andyour strength , weakness etc.6) Geeks for geeks and career cup were the websites I had referred to for all my codingrelated preparation. ALL THE BEST !!! 
College Name: vjti

Skills evaluated in this interview

Interview Questionnaire 

8 Questions

  • Q1. “Compress a text string in place”. Having seen the famous string expansion in place problem many times, I promptly said run length encoding (i.e. compress aaaaaabbbbbccc to a6b5c3 for example). He asked me...
  • Ans. 

    Code a run length encoding algorithm to compress a text string in place.

    • Use a loop to iterate through the string and count consecutive characters

    • Create a new string to store the compressed version of the original string

    • Add the character and its count to the new string

    • Compare the length of the new string to the original string to determine if compression was successful

  • Answered by AI
  • Q2. Given a binary search tree and a no. N in the tree, print the leftmost node at the same level as N
  • Ans. 

    Print the leftmost node at the same level as a given node in a binary search tree.

    • Traverse the tree level by level using BFS

    • Keep track of the leftmost node at each level

    • Return the leftmost node at the level of the given node

    • If the given node is not found, return null

  • Answered by AI
  • Q3. WAP to print a matrix spirally. I told him I knew the problem so he skipped it
  • Q4. Search for an element in a rotated sorted array (of course in sublinear time!)
  • Ans. 

    Search for an element in a rotated sorted array in sublinear time.

    • Use binary search to find the pivot point where the array is rotated.

    • Determine which half of the array the target element is in.

    • Perform binary search on the appropriate half of the array to find the target element.

    • Time complexity is O(log n).

  • Answered by AI
  • Q5. Nice DP problem. Given an amount and an array containing possible coin denominations, determine the smallest no of coins in which the amount may be formed. Assume you have infinite units of each denominati...
  • Ans. 

    Given an amount and coin denominations, find the smallest no of coins to form the amount.

    • Use dynamic programming to solve the problem

    • Create a table to store the minimum number of coins required for each amount

    • Iterate through the denominations and update the table accordingly

    • Return the minimum number of coins required for the given amount

  • Answered by AI
  • Q6. Given a linked list, swap its nodes pairwise. A good test of pointer manipulation with many edge
  • Q7. Given an array, bring all its distinct elements to the top in any order, the rest of the array is not
  • Ans. 

    Move all distinct elements of an array to the top in any order.

    • Create a new array to store distinct elements

    • Loop through the original array and check if element is already in new array

    • If not, add it to the new array and remove it from the original array

    • Concatenate the new array with the remaining elements of the original array

  • Answered by AI
  • Q8. Given a matrix, find an element that is max in its row and min in its col. The actual question (after I wrote the function) was whether there can be more than one such element in the matrix,
  • Ans. 

    There can be multiple such elements in the matrix.

    • Multiple elements can be max in their row and min in their col

    • The function should return all such elements

    • The elements can be in different rows and columns

  • Answered by AI

Interview Preparation Tips

Round: Test
Duration: 60 minutes

Round: Technical Interview
Experience: 1. After that he asked me a problem.“Compress a text string in place”. Having seen the famous string expansion in place problem many times, I promptly said run length encoding (i.e. compress aaaaaabbbbbccc to a6b5c3 for example). He asked me to code it and write a few test cases for it. The most important test case in my opinion is the following:
a -> a and not a1, i.e. for a single occurrence of a character, do not write its count – the reason
being that the string, instead of getting compressed, gets expanded in that case.
Tips: nitially he started with a discussion of my final year project. After about 10 minutes of discussion, I think he concluded it was too early for me to know my own project topic well. Since the area of my project is network security, the rest of the discussion revolved around it. He went into the details of cryptography and attacks like buffer overflow, asking me to basically just assure him I knew what I was speaking (discuss those things orally, and occasionally write small snippets). One particularly ridiculous part of this interview that I happen to remember was me having uttered the term ‘canary bit’, followed by him torturing me around it for about 10 minutes, he asked me what exactly it is, how I thought it could be implemented, if I could draw a rudimentary design of such a subsystem and all. The whole discussion went on for say 50 minutes or so.

Round: Technical Interview
Experience: This was a nice, pure problem-solving round.
First, he asked me the famous “Tell me about yourself” and “How were your earlier rounds”
questions. But they were just ice-breakers.

Round: Technical Interview
Experience: This was the most enjoyable round. The interviewer was a final round specialist!
First, he asked me about my internship, which I explained to him. He discussed it for hardly 10
minutes.
Then he started his attack! (Yes, it literally felt like an attack – just like Ronnie O’Sullivan There were three questions here:
Q1. Given a linked list, swap its nodes pairwise. A good test of pointer manipulation with many edge
Q2. Given an array, bring all its distinct elements to the top in any order, the rest of the array is not
important. First I suggested in O(n) space. Then he asked me to do it without extra space. I
needed a sorted array for that, which he asked me to assume. The rest of it is based on swapping
elements in order to bring the required elements to the top.
Q3. Given a matrix, find an element that is max in its row and min in its col. The actual question
(after I wrote the function) was whether there can be more than one such element in the matrix,
assuming all elements are distinct. Wrote a small proof that there cannot. He literally asked for a
formal proof “as I would write it in an exam”!Finally I got placed. I was on cloud 9.. All the best

Skills: Data srtructure, Cryptography, Algorithm
College Name: NA

Skills evaluated in this interview

Top Microsoft Corporation Software Developer Interview Questions and Answers

Q1. Buses Origin Problem Statement You have been provided with an array where each element specifies the number of buses that can be boarded at each respective bus stop. Buses will only stop at locations that are multiples of the bus stop they ... read more
View answer (3)

Software Developer Interview Questions asked at other Companies

Q1. Maximum Subarray Sum Problem Statement Given an array of integers, determine the maximum possible sum of any contiguous subarray within the array. Example: Input: array = [34, -50, 42, 14, -5, 86] Output: 137 Explanation: The maximum sum is... read more
View answer (42)

Microsoft Corporation interview questions for popular designations

 Software Engineer

 (65)

 Software Developer

 (62)

 Senior Software Engineer

 (28)

 Software Developer Intern

 (24)

 Intern

 (20)

 Technical Support Engineer

 (14)

 Software Development Engineer

 (11)

 Data Scientist

 (10)

Interview Questions & Answers

user image Anonymous

posted on 14 May 2015

Interview Preparation Tips

Round: Test
Experience: Question 1 : Given a binary search tree . Print its level order traversal in reverse order level wise .eg if level order is 1234567 then required output was 1327654Question 2: Given a binary search tree , Print its zig zag traversal .Complete syntactically correct code was required with all corner cases covered .

Round: Technical Interview
Experience: He asked me to Introduce myself and then started asking me about my project
1. Print the given matrix in spiral order .----- should be syntactically correct with all corner cases handled in a single attempt. 
2.Count all possible decodings of a given digit sequence .----- I started off with a recursive solution and came up with Dynamic programming solution afterwards. Full working code was required without any corner case missing.He asked to list down all the possible test cases for the given scenario . He was very particular about the Test cases .

Round: Technical Interview
Experience: He asked me to introduce myself.1.He asked me about the current project which i m working on.. and a few questions on the technologies which were used in the project.He was very particular about my project discussion.2. Given a linked list consisting of String in each Node . Given just a pointer to the head Node , I was required to find whether the resultant String formed by combining all the Nodes of the linked list is a palindrome or not .eg – Consider this linked List structure“aba” -> “cd” -> “efe” -> “d” -> “caba”Hence this structure is palindrome . Was required to check for palindrome online as Linked List length could be infinite at any point of time .I was required to discuss and write full code on the whiteboard starting from Node structure to the end logic .After that i was required to list down Test Cases for the same .

College Name: NA

Get interview-ready with Top Microsoft Corporation Interview Questions

Interview Questionnaire 

12 Questions

  • Q1. Two numbers are stored in two linked lists, with one digit in each node. Add the numbers and return the resultant sum in a linked list. eg. if LL1= 2 ­> 3 ­> 5, LL2= 1­>4­>5, result should be LL3= 3­>8­>0
  • Ans. 

    The question asks to add two numbers represented as linked lists and return the sum as a linked list.

    • Traverse both linked lists simultaneously, adding the corresponding digits and carrying over the carry.

    • Create a new linked list to store the sum digits.

    • Handle cases where one linked list is longer than the other.

    • Consider cases where the sum has an additional carry digit at the end.

  • Answered by AI
  • Q2. Check the no of repeated occurences of a substring in a string
  • Ans. 

    Count the number of times a substring appears in a string.

    • Use a loop to iterate through the string and check for the substring at each index.

    • Use the count() method to count the number of occurrences of the substring.

    • Consider using regular expressions to find all occurrences of the substring.

    • Handle edge cases such as empty strings or substrings.

  • Answered by AI
  • Q3. Data compression: Given a string “aabbbccc”, save it as “a2b3c3”. Here, I was asked to write a pseudocode, followed by a code in C++, optimize it and then all the testcases. Eg. “aabcc” would become “a2bc2...
  • Ans. 

    The task is to compress a given string by replacing consecutive repeated characters with the character followed by the count of repetitions.

    • Iterate through the string and keep track of the current character and its count.

    • If the next character is the same as the current character, increment the count.

    • If the next character is different, append the current character and its count to the result string.

    • Return the compressed

  • Answered by AI
  • Q4. Given a node in a binary tree, find the leftmost node in the same level
  • Ans. 

    Find the leftmost node in the same level as a given node in a binary tree.

    • Traverse the tree level by level using BFS

    • For each level, keep track of the leftmost node encountered

    • Return the leftmost node in the level of the given node

  • Answered by AI
  • Q5. Find the nth largest number in a binary tree
  • Ans. 

    Find the nth largest number in a binary tree

    • Traverse the tree in-order and store the values in an array

    • Return the (n-1)th index of the sorted array in descending order

    • Use a max heap to keep track of the largest n elements

  • Answered by AI
  • Q6. Insert an element into a sorted circular linked list. (Consider all cases, inserting in the beginning, end and middle)
  • Ans. 

    Insert an element into a sorted circular linked list.

    • Find the correct position to insert the element based on its value

    • Update the pointers of the previous and next nodes to include the new node

    • Handle special cases such as inserting at the beginning or end of the list

    • Example: Inserting 5 into a list with values 1, 3, 4, 6, 7 would result in 1, 3, 4, 5, 6, 7

  • Answered by AI
  • Q7. Given 5 points in a plane, prove that there will be atleast two points such that their midpoint is an integer
  • Ans. 

    Prove that given 5 points in a plane, there will be at least two points such that their midpoint is an integer.

    • Consider the x and y coordinates of the 5 points.

    • If any two points have the same x and y coordinates, their midpoint will be an integer.

    • If not, consider the differences between the x and y coordinates of each pair of points.

    • If any two pairs have differences that are both even or both odd, their midpoints will ...

  • Answered by AI
  • Q8. Given a room with points pertaining to different groups, check whether the connection is planar or non­planar i.e. while connecting all the points in the same group, the wires of different groups should no...
  • Q9. Find the nth power of a number in shortest computational time
  • Ans. 

    Use exponentiation by squaring algorithm to find nth power of a number in shortest computational time.

    • Use recursion to divide the power by 2 and multiply the base accordingly

    • If power is odd, multiply the base with the result of recursive call

    • If power is negative, take reciprocal of base and make power positive

    • Handle edge cases like power=0 and base=0 or 1

    • Time complexity is O(log n)

  • Answered by AI
  • Q10. There is a roller which can have two types of wood blocks, 49 cm and 50 cm. Given two sensors 50 cm apart which call a function ring( ) whenever the sensor changes state, write the function ring( ) to cal...
  • Ans. 

    The function ring() calculates the number of blocks of both types based on sensor state changes.

    • Create a variable to keep track of the number of 49 cm blocks

    • Create another variable to keep track of the number of 50 cm blocks

    • Initialize both variables to 0

    • Whenever the sensor changes state, increment the corresponding block variable

    • Return the count of both block types as an array of strings

  • Answered by AI
  • Q11. Given a linked list, invert every two nodes in the list.Eg. Given a ­> b ­> c ­> d, result should be b ­> a ­> d ­> c
  • Ans. 

    The given linked list needs to be inverted in pairs of two nodes.

    • Iterate through the linked list, swapping every two adjacent nodes.

    • Keep track of the previous node to update the next pointers correctly.

    • Handle the edge cases of odd number of nodes or empty list.

  • Answered by AI
  • Q12. A file or a directory can be represented as a node. The node has properties like ID no, parent ID no, name, no of children( 0 for a file). The entire file structure is represented as a linked list of the ...

Interview Preparation Tips

Round: Technical Interview
Experience: After 3 interviews, I was called for a final interview. He started by asking me about my best project and the drawbacks I faced in it. He asked about my internship and the workingexperience. This interview went on for more than an hour with him grilling me on two questions and their testcases.Q1. Given a linked list, invert every two nodes in the list.Eg. Given a ­> b ­> c ­> d, result should be b ­> a ­> d ­> c
Q2. A file or a directory can be represented as a node. The node has properties like ID no, parent ID no, name, no of children( 0 for a file). The entire file structure is represented as a linked list of the nodes. Only thing known to us is that the parent directory will always come before the children in the LL. It need not come immediately before.We have to implement a GUI such that when I press on the + button next to the root directory, I see its children folders and files. The child directories have a + button next to them and can be expanded similarly.Write a pseudocode to implement this in minimum time and space.I suggested the use of a tree, wrote a code to convert it to a tree. He wanted a better way of finding children from the parent so I suggested a hash table comprising a hashing of the parent IDs to a LL of the children IDs.
He was satisfied with the answer.

Skills: Algortihm, Data structure, C++
College Name: Na

Skills evaluated in this interview

Top Microsoft Corporation Software Developer Interview Questions and Answers

Q1. Buses Origin Problem Statement You have been provided with an array where each element specifies the number of buses that can be boarded at each respective bus stop. Buses will only stop at locations that are multiples of the bus stop they ... read more
View answer (3)

Software Developer Interview Questions asked at other Companies

Q1. Maximum Subarray Sum Problem Statement Given an array of integers, determine the maximum possible sum of any contiguous subarray within the array. Example: Input: array = [34, -50, 42, 14, -5, 86] Output: 137 Explanation: The maximum sum is... read more
View answer (42)

Interview Questions & Answers

user image Anonymous

posted on 15 May 2015

Interview Preparation Tips

Round: Technical Interview
Experience: Given a circular buffer, write Get( ) and Post( ) methods . Get(n) should return the n characters in the string, if ‘n’ elements are not present, it should throw an exception. Put( string s) should put each of the characters of string s into the buffer without overwriting anything which hasn’t been read by Get()

Round: Technical Interview
Experience: Longest common substring from 2 given strings. As I couldn’t give optimal solutions, asked me to write a strcmp(str1, str2) method

Round: Technical Interview
Experience: Write a secure and safe strcpy( ) method . Asked me some theoretical questions about indexing and triggers for sql

Round: Technical Interview
Experience: Write a program which generates XLS column numbers given the column number in decimal.
e.g.Input Output
1 A
2 B
26 Z
27 AA
52 AZ
53 BA
...

College Name: NA

Interview Questionnaire 

12 Questions

  • Q1. Two numbers are stored in two linked lists, with one digit in each node. Add the numbers and return the resultant sum in a linked list. eg. if LL1= 2 ­> 3 ­> 5, LL2= 1­>4­>5, result should be LL3= 3­>8­>0
  • Ans. 

    Add two numbers stored in linked lists and return the sum in a linked list.

    • Traverse both linked lists and add the digits at each node while keeping track of carry.

    • Create a new linked list to store the sum digits.

    • Handle cases where one linked list is longer than the other.

    • Handle cases where the sum of the last digits results in a carry.

    • Return the new linked list with the sum digits.

  • Answered by AI
  • Q2. Check the no of repeated occurences of a substring in a string
  • Ans. 

    Count the number of times a substring appears in a string.

    • Use a loop to iterate through the string and check for the substring at each index.

    • Use the count() method to count the number of occurrences of the substring.

    • Consider using regular expressions to find all occurrences of the substring.

    • Handle edge cases such as empty strings or substrings.

  • Answered by AI
  • Q3. How the memory is structured (heap, stack, etc). He wrote a program and asked which variables would be stored where etc. As I mentioned that I like Algorithms, he then went on to Algos
  • Q4. Data compression: Given a string “aabbbccc”, save it as “a2b3c3”. Here, I was asked to write a pseudocode, followed by a code in C++, optimize it and then all the testcases. Eg. “aabcc” would become “a2bc2...
  • Ans. 

    Compress a string by replacing consecutive characters with their count.

    • Iterate through the string and count consecutive characters.

    • Append the character and its count to a new string.

    • Handle edge cases like single characters.

  • Answered by AI
  • Q5. Given a node in a binary tree, find the leftmost node in the same level. I wrote the pseudocode, and testcases
  • Ans. 

    Find the leftmost node in the same level as a given node in a binary tree.

    • Traverse the tree level by level using BFS

    • For each level, keep track of the leftmost node encountered

    • Return the leftmost node at the same level as the given node

  • Answered by AI
  • Q6. Find the nth largest number in a binary tree
  • Ans. 

    Find the nth largest number in a binary tree

    • Traverse the tree in-order and store the values in an array

    • Return the (n-1)th index of the sorted array in descending order

    • Use a max heap to keep track of the largest n elements

  • Answered by AI
  • Q7. Given 5 points in a plane, prove that there will be atleast two points such that their midpoint is an integer
  • Ans. 

    Prove that given 5 points in a plane, there will be at least two points such that their midpoint is an integer.

    • Consider the x and y coordinates of the 5 points.

    • If any two points have the same x and y coordinates, their midpoint will be an integer.

    • If not, consider the differences between the x and y coordinates of each pair of points.

    • If any two pairs have the same differences, their midpoints will be integers.

    • Otherwise,...

  • Answered by AI
  • Q8. Given a room with points pertaining to different groups, check whether the connection is planar or non­planar i.e. while connecting all the points in the same group, the wires of different groups should no...
  • Q9. Find the nth power of a number in shortest computational time
  • Ans. 

    Use exponentiation by squaring algorithm to find nth power of a number in shortest computational time.

    • Use recursion to divide the power by 2 and multiply the base accordingly

    • If power is odd, multiply the base with the result of recursive call

    • If power is negative, take reciprocal of base and make power positive

    • Handle edge cases like power=0 and base=0 or 1

    • Time complexity is O(log n)

  • Answered by AI
  • Q10. There is a roller which can have two types of wood blocks, 49 cm and 50 cm. Given two sensors 50 cm apart which call a function ring( ) whenever the sensor changes state, write the function ring( ) to cal...
  • Ans. 

    Function to calculate number of 49cm and 50cm wood blocks using two sensors 50cm apart.

    • Create a variable to store the count of 49cm blocks and another for 50cm blocks

    • Use a loop to continuously check the state of the sensors and increment the respective block count

    • Call the ring() function whenever the state of the sensors change

    • Return the count of both types of blocks

  • Answered by AI
  • Q11. Given a linked list, invert every two nodes in the list.Eg. Given a ­> b ­> c ­> d, result should be b ­> a ­> d ­> c
  • Ans. 

    Invert every two nodes in a linked list.

    • Create a temporary node to store the next node

    • Swap the positions of the current and next nodes

    • Set the current node's next to the temporary node

    • Move to the next pair of nodes and repeat until end of list

  • Answered by AI
  • Q12. A file or a directory can be represented as a node. The node has properties like ID no, parent ID no, name, no of children( 0 for a file). The entire file structure is represented as a linked list of the ...

Interview Preparation Tips

Round: Technical Interview
Experience: This interview went on for about an hour.

Round: Technical Interview
Experience: After three interviews, I was called for a final interview.He started by asking me about my best project and the drawbacks I faced in it. He asked about my internship and the working experience. This interview went on for more than an hour with him grilling me on two questions and their testcases.Q1. Given a linked list, invert every two nodes in the list.Eg. Given a ­> b ­> c ­> d, result should be b ­> a ­> d ­> cQ2. A file or a directory can be represented as a node. The node has properties like ID no, parent ID no, name, no of children( 0 for a file). The entire file structure is represented as a linked list of the nodes. Only thing known to us is that the parent directory will always come before the children in the LL. It need not come immediately before.We have to implement a GUI such that when I press on the + button next to the root directory, I see its children folders and files. The child directories have a + button next to them and can be expanded similarly.Write a pseudocode to implement this in minimum time and space.I suggested the use of a tree, wrote a code to convert it to a tree. He wanted a better way of finding children from the parent so I suggested a hash table comprising a hashing of the parent IDs to a LL of the children IDs. He was satisfied with the answer.

General Tips: 1. All interviews were mostly technical and the interviewers were calm and patient, though they didn’t provide help as such. Be confident but if you have no idea about a given question, mention that this is not your area of interest and see if they can ask another one.2. Even if you cannot find the exact code to a problem, it is fine because they are only looking at how intuitive you are withproblem solving.3. Don’t fib in your resume. They asked me a lot pertaining to my resume.4. Do data structures and operating system properly. They did not ask me any database ­related question.
Skills: Algorithm, Data structure, C++
College Name: na

Skills evaluated in this interview

Top Microsoft Corporation Software Developer Interview Questions and Answers

Q1. Buses Origin Problem Statement You have been provided with an array where each element specifies the number of buses that can be boarded at each respective bus stop. Buses will only stop at locations that are multiples of the bus stop they ... read more
View answer (3)

Software Developer Interview Questions asked at other Companies

Q1. Maximum Subarray Sum Problem Statement Given an array of integers, determine the maximum possible sum of any contiguous subarray within the array. Example: Input: array = [34, -50, 42, 14, -5, 86] Output: 137 Explanation: The maximum sum is... read more
View answer (42)

Interview Questions & Answers

user image Anonymous

posted on 16 May 2015

Interview Questionnaire 

4 Questions

  • Q1. Given an array. write a function to find if the array satisfies the condition min^2 < max is satisfied. That is it should return 0 or 1 accordingly
  • Ans. 

    Function to check if min^2 < max condition is satisfied in an array of strings

    • Convert array elements to integers

    • Find the minimum and maximum values in the array

    • Check if min^2 < max, return 1 if true, 0 if false

  • Answered by AI
  • Q2. Given an operation delfirst() which deletes the first element of the array. Given an array. how many such operation is needed to get an array which satisfies the condition 1
  • Ans. 

    The number of delfirst() operations needed to satisfy a condition in an array.

    • The number of delfirst() operations needed is equal to the index of the first element that satisfies the condition.

    • For example, if the array is ['apple', 'banana', 'cherry'] and the condition is to have the first element start with 'b', then 1 delfirst() operation is needed to get ['banana', 'cherry'].

  • Answered by AI
  • Q3. Given an operation delfirst() and dellast() which deletes the first element and last element of the array respectively. Given an array. how many such operations is needed to get an array which satisfies th...
  • Ans. 

    To satisfy the condition 1, only one operation is needed - either delfirst() or dellast().

    • To satisfy the condition 1, you can either use delfirst() or dellast() operation once.

    • For example, if the array is ['a', 'b', 'c', 'd'], you can use delfirst() operation to get ['b', 'c', 'd'] or dellast() operation to get ['a', 'b', 'c'].

  • Answered by AI
  • Q4. Given a SLL find the longest palindrome in it

Interview Preparation Tips

Round: Test
Experience: Given a number in a linked list find the next greater permutation.

Round: HR Interview
Experience: about myself why i am interested in a switch etc etcIt was a hiring drive for MBS group bangalore location.. The interview process was easy and well structured. Though the questions are easy the interviewer explored all the intricacies and I had to write full code for all the cases. Taking care of corner cases and optimizing time and space complexities. Each round went for 45min to 1 hr.

General Tips: My suggestion will be brush up your basics. Don’t try to write down the optimized code at the very beginning. give a simple solution first and gradually optimize it.
College Name: NA

Skills evaluated in this interview

Interview Questions & Answers

user image Anonymous

posted on 11 May 2015

Interview Questionnaire 

18 Questions

  • Q1. Given a large int array, sort it. The ints are in the range 1-10
  • Ans. 

    Sort a large int array in the range 1-10.

    • Use counting sort algorithm for efficient sorting.

    • Create a count array to store the frequency of each number.

    • Iterate through the count array to reconstruct the sorted array.

  • Answered by AI
  • Q2. In a 2-D array of 0’s and 1’s find the row with max 1’s, given that the array is sorted row wise
  • Q3. Find the maximum contiguous sum in an array. Had to write test cases as well
  • Q4. On a screen, there are multiple rectangles drawn, when a user clicks on any point, find the smallest rectangle enclosing this point
  • Ans. 

    Given multiple rectangles on a screen, find the smallest rectangle enclosing a user-clicked point.

    • Iterate through each rectangle and check if the clicked point lies within its boundaries

    • Keep track of the smallest enclosing rectangle found so far

    • Return the smallest enclosing rectangle

  • Answered by AI
  • Q5. Design poke feature in Facebook
  • Ans. 

    The poke feature in Facebook allows users to send a quick and playful gesture to get someone's attention.

    • Users can poke their friends to say hello or get their attention.

    • Poking someone sends them a notification.

    • Pokes can be sent back and forth between friends.

    • Pokes can be used as a fun way to interact with friends without sending a message.

  • Answered by AI
  • Q6. Implement file read operation asyncronously
  • Q7. There are N large log files in sorted by timestamp. Merge them
  • Q8. There are N large files containing operations sorted based on name to be done on an address book
  • Ans. 

    Merge N large files containing operations sorted by name for an address book

    • Read each file and merge the operations based on name

    • Use a sorting algorithm to maintain the order while merging

    • Handle duplicate operations for the same name

    • Consider memory constraints while merging large files

  • Answered by AI
  • Q9. Some discussion on foreground and background thread
  • Q10. What is common in 2 threads of the same process and what is the difference
  • Ans. 

    Common in 2 threads: share same memory space, variables, code, and resources. Difference: have separate execution paths and stack.

    • Common: share same memory space, variables, code, and resources

    • Difference: have separate execution paths and stack

    • Example: Two threads in a process sharing access to a global variable

  • Answered by AI
  • Q11. How would you communicate between 2 processes
  • Ans. 

    Communication between 2 processes can be achieved through inter-process communication mechanisms.

    • Use pipes to establish a unidirectional communication channel between processes

    • Use sockets for bidirectional communication over a network

    • Shared memory can be used to exchange data between processes

    • Message queues provide a way to send and receive messages between processes

    • Signals can be used to notify and communicate between

  • Answered by AI
  • Q12. Can we create connection between 2 processes similar to tcp connection
  • Q13. Difference between tcp and udp
  • Q14. Are packets lost in tcp if network is never lost
  • Q15. Create a macro for reversing an int in terms of byte e.g. an int has 4 bytes numbered 1234 the macro should return 4321
  • Q16. In a 2-D array of chars, if a user selects any 4 boxes, check if these are continuous or not. continuous boxes are those which lie in 3×3 sub array surrounding the box
  • Ans. 

    Check if 4 selected boxes in a 2-D array of chars are continuous in the 3x3 sub array surrounding each box.

    • Iterate through the selected boxes and check if they are within the 3x3 sub array of each box.

    • Consider edge cases where the selected boxes are at the boundaries of the array.

    • Example: If the selected boxes are (1,1), (1,2), (2,1), (2,2), they form a continuous 2x2 sub array.

  • Answered by AI
  • Q17. Design auto complete feature
  • Q18. Some other OS questions on threads only

Interview Preparation Tips

Round: Technical Interview
Experience: Address book is stored as name value pair in another file which is sorted based on name. Apply these operations and store in a new address file.
Had to write code and test cases for this.

College Name: NA

Skills evaluated in this interview

Microsoft Corporation Interview FAQs

How many rounds are there in Microsoft Corporation interview?
Microsoft Corporation interview process usually has 2-3 rounds. The most common rounds in the Microsoft Corporation interview process are Technical, Coding Test and One-on-one Round.
How to prepare for Microsoft Corporation interview?
Go through your CV in detail and study all the technologies mentioned in your CV. Prepare at least two technologies or languages in depth if you are appearing for a technical interview at Microsoft Corporation. The most common topics and skills that interviewers at Microsoft Corporation expect are microsoft, Computer science, C++, Coding and Python.
What are the top questions asked in Microsoft Corporation interview?

Some of the top questions asked at the Microsoft Corporation interview -

  1. You are given infinite sequence of continuos natural numbers-1,2,3,4,5,6.........read more
  2. You have a cuboid (m*n*p) each block of the cuboid is having a metallic ball. ...read more
  3. Given a string of containing lower case letters and upper case characters. Find...read more
How long is the Microsoft Corporation interview process?

The duration of Microsoft Corporation interview process can vary, but typically it takes about less than 2 weeks to complete.

Tell us how to improve this page.

Microsoft Corporation Interview Process

based on 375 interviews

Interview experience

4.2
  
Good
View more

Interview Questions from Similar Companies

Accenture Interview Questions
3.8
 • 8.1k Interviews
IBM Interview Questions
4.0
 • 2.3k Interviews
Oracle Interview Questions
3.7
 • 846 Interviews
Google Interview Questions
4.4
 • 823 Interviews
Amdocs Interview Questions
3.7
 • 514 Interviews
Dell Interview Questions
4.0
 • 386 Interviews
Cisco Interview Questions
4.1
 • 370 Interviews
SAP Interview Questions
4.2
 • 283 Interviews
Adobe Interview Questions
3.9
 • 233 Interviews
Intel Interview Questions
4.2
 • 214 Interviews
View all

Microsoft Corporation Reviews and Ratings

based on 1.7k reviews

4.0/5

Rating in categories

3.9

Skill development

4.0

Work-life balance

3.9

Salary

3.5

Job security

4.0

Company culture

3.4

Promotions

3.7

Work satisfaction

Explore 1.7k Reviews and Ratings
Software Engineer
1.6k salaries
unlock blur

₹16 L/yr - ₹50 L/yr

Senior Software Engineer
1.1k salaries
unlock blur

₹25 L/yr - ₹96 L/yr

Software Engineer2
1k salaries
unlock blur

₹20 L/yr - ₹72 L/yr

Software Developer
762 salaries
unlock blur

₹14 L/yr - ₹50.4 L/yr

Consultant
600 salaries
unlock blur

₹13 L/yr - ₹36.7 L/yr

Explore more salaries
Compare Microsoft Corporation with

Google

4.4
Compare

Amazon

4.1
Compare

Deloitte

3.8
Compare

TCS

3.7
Compare
Did you find this page helpful?
Yes No
write
Share an Interview