Upload Button Icon Add office photos

Microsoft Corporation

Compare button icon Compare button icon Compare

Filter interviews by

Microsoft Corporation SDE Interview Questions and Answers

Updated 11 Jan 2025

14 Interview questions

A SDE was asked 5mo ago
Q. How does BitTorrent work?
Ans. 

BitTorrent is a peer-to-peer file sharing protocol that allows users to distribute large amounts of data over the internet.

  • BitTorrent breaks down files into small pieces and distributes them among multiple users.

  • Users download and upload pieces of the file simultaneously, increasing download speeds.

  • Users connect to a tracker to find other users sharing the same file.

  • Popular BitTorrent clients include uTorrent, Bit...

A SDE was asked
Q. How can you reverse a tree using Data Structures and Algorithms (DSA)?
Ans. 

Reverse a tree using DSA involves traversing the tree in a specific order and swapping the left and right child nodes.

  • Start by traversing the tree in post-order or level-order traversal.

  • Swap the left and right child nodes of each node as you traverse the tree.

  • Continue until all nodes have been visited and their children swapped.

SDE Interview Questions Asked at Other Companies

asked in Infosys
Q1. Return Subsets Sum to K Problem Statement Given an integer array ... read more
asked in Nagarro
Q2. Partition to K Equal Sum Subsets Problem Given an array of intege ... read more
asked in Nagarro
Q3. Sort a "K" Sorted Doubly Linked List Given a doubly-linked list w ... read more
asked in Amazon
Q4. Describe a scenario where you were given updates on repaired road ... read more
asked in Nagarro
Q5. Maximum Meetings Selection You are tasked with scheduling meeting ... read more
A SDE was asked
Q. Find the two largest elements in an array with O(n+log(n)) comparison.
Ans. 

Find 2 maximum elements in array in O(n+log(n)) comparison

  • Use divide and conquer approach

  • Divide array into two halves

  • Recursively find max elements in each half

  • Compare the two max elements to find the overall max elements

A SDE was asked
Q. Implement a tournament tree and write code to determine the winner.
Ans. 

Tournament tree is a binary tree where each node represents a match between two players/teams.

  • Tournament tree is used in sports tournaments to determine the winner.

  • The leaf nodes represent the players/teams and the internal nodes represent the matches.

  • The winner of each match is the node with the higher score.

  • Code can be written using a recursive function to traverse the tree and determine the winner.

What people are saying about Microsoft Corporation

View All
a software developer
5d
Just Microsoft things!
Offer sleeping pods in office Employees turn unproductive Revenue drops Fire Thousands of employees in the name of "AI Revolution"!
FeedCard Image
Got a question about Microsoft Corporation?
Ask anonymously on communities.
A SDE was asked
Q. Given an array, find an index in the array such that the sum of elements before it is equal to the sum of elements after it.
Ans. 

Find an index in array where sum of elements on left side is equal to sum of elements on right side.

  • Loop through array and calculate sum of all elements

  • Then loop through array again and check if sum of elements on left side is equal to sum of elements on right side

  • Return the index if found, else return -1

A SDE was asked
Q. Given a 2D array of 0s and 1s where each row is sorted, find the row with the maximum number of 1s in minimum time complexity.
Ans. 

Find row with maximum 1s in a sorted 2D array of 0s and 1s.

  • Use binary search to find the first occurrence of 1 in each row.

  • Calculate the number of 1s in each row using the index found in step 1.

  • Keep track of the row with maximum number of 1s.

  • Time complexity: O(m log n), where m is the number of rows and n is the number of columns.

A SDE was asked
Q. Given an array of non-negative integers, where each element represents the maximum number of steps that can be taken forward from that element, find the minimum number of jumps to reach the end of the array...
Ans. 

Find minimum number of jumps required to reach end of array with max moves in right direction at each index.

  • Use dynamic programming approach to solve the problem

  • Maintain an array to store minimum number of jumps required to reach each index

  • Traverse the array and update the minimum number of jumps for each index

  • Return the minimum number of jumps required to reach the end of array

Are these interview questions helpful?
A SDE was asked
Q. Given an array that is alternatively sorted, what is the time complexity to find an element in it? For example: 14, 3, 16, 6, 22, 7, 24, 11, 27.
Ans. 

Time complexity to find an element in an alternatively sorted array.

  • The time complexity will be O(log n) using binary search.

  • Check the middle element and compare with the target element.

  • If the middle element is greater than the target, search in the left half of the array.

  • If the middle element is smaller than the target, search in the right half of the array.

  • Repeat until the target element is found or the array is...

A SDE was asked
Q. Given an unsorted array of size 5, what is the minimum number of comparisons needed to find the median? How does this change for an array of size n?
Ans. 

Minimum comparisons needed to find median in unsorted array of size n

  • For odd n, median is the middle element. For even n, median is the average of middle two elements

  • Minimum comparisons needed for odd n is (n-1)/2. For even n, it is n/2

  • Various sorting algorithms can be used to find median in an unsorted array

A SDE was asked
Q. Given an array A[n] such that A[i+1] = A[i]+1 OR A[i]-1, and a number k, find out whether k is present in A[n] or not, in the most efficient way?
Ans. 

Efficiently check if a number is present in an array where each element differs by 1.

  • Use binary search to find the element in the array

  • Calculate the difference between the middle element and the first element

  • If the difference is equal to the index of the middle element minus the index of the first element, then the left half of the array is consecutive

  • If the difference is not equal, then the right half of the arra...

Microsoft Corporation SDE Interview Experiences

6 interviews found

SDE Interview Questions & Answers

user image Lakshay Dabas

posted on 11 Jan 2025

Interview experience
4
Good
Difficulty level
-
Process Duration
-
Result
-
Round 1 - Technical 

(2 Questions)

  • Q1. Traverse Binary Tree
  • Ans. 

    Traverse a binary tree in different orders (inorder, preorder, postorder)

    • Inorder traversal: Left, Root, Right

    • Preorder traversal: Root, Left, Right

    • Postorder traversal: Left, Right, Root

  • Answered by AI
  • Q2. How does bittorent work
  • Ans. 

    BitTorrent is a peer-to-peer file sharing protocol that allows users to distribute large amounts of data over the internet.

    • BitTorrent breaks down files into small pieces and distributes them among multiple users.

    • Users download and upload pieces of the file simultaneously, increasing download speeds.

    • Users connect to a tracker to find other users sharing the same file.

    • Popular BitTorrent clients include uTorrent, BitTorre...

  • Answered by AI

SDE Interview Questions & Answers

user image Anonymous

posted on 29 Nov 2024

Interview experience
4
Good
Difficulty level
Moderate
Process Duration
Less than 2 weeks
Result
Not Selected

I applied via LinkedIn and was interviewed in Oct 2024. There were 2 interview rounds.

Round 1 - Coding Test 

Abcdef jssu ksye ksyd kahe jeheb

Round 2 - Technical 

(2 Questions)

  • Q1. Introduce yourself
  • Q2. Project related questions

SDE Interview Questions & Answers

user image Anonymous

posted on 26 Feb 2024

Interview experience
4
Good
Difficulty level
-
Process Duration
Less than 2 weeks
Result
Not Selected

I applied via Campus Placement and was interviewed in Jan 2024. There was 1 interview round.

Round 1 - Coding Test 

3 coding questions, mostly focused on dp, graphs strings and arrays, it was medium to hard level

SDE Interview Questions & Answers

user image Anonymous

posted on 19 Sep 2023

Interview experience
3
Average
Difficulty level
Hard
Process Duration
4-6 weeks
Result
Not Selected

I applied via LinkedIn and was interviewed in Mar 2023. There were 3 interview rounds.

Round 1 - Resume Shortlist 
Pro Tip by AmbitionBox:
Keep your resume crisp and to the point. A recruiter looks at your resume for an average of 6 seconds, make sure to leave the best impression.
View all tips
Round 2 - HR 

(1 Question)

  • Q1. Tell me about yourself
Round 3 - Technical 

(1 Question)

  • Q1. Reverse a tree using DSA
  • Ans. 

    Reverse a tree using DSA involves traversing the tree in a specific order and swapping the left and right child nodes.

    • Start by traversing the tree in post-order or level-order traversal.

    • Swap the left and right child nodes of each node as you traverse the tree.

    • Continue until all nodes have been visited and their children swapped.

  • Answered by AI

Skills evaluated in this interview

SDE Interview Questions & Answers

user image Anonymous

posted on 5 Jun 2015

Interview Questionnaire 

6 Questions

  • Q1. Find a equilibrium index in array
  • Ans. 

    Find an index in array where sum of elements on left side is equal to sum of elements on right side.

    • Loop through array and calculate sum of all elements

    • Then loop through array again and check if sum of elements on left side is equal to sum of elements on right side

    • Return the index if found, else return -1

  • Answered by AI
  • Q2. Find the minimum no of jumps required to reach the end of array.where element at each index represent how many max moves you will take in right
  • Ans. 

    Find minimum number of jumps required to reach end of array with max moves in right direction at each index.

    • Use dynamic programming approach to solve the problem

    • Maintain an array to store minimum number of jumps required to reach each index

    • Traverse the array and update the minimum number of jumps for each index

    • Return the minimum number of jumps required to reach the end of array

  • Answered by AI
  • Q3. Tournament tree puzzle and write code for that
  • Ans. 

    Tournament tree is a binary tree where each node represents a match between two players/teams.

    • Tournament tree is used in sports tournaments to determine the winner.

    • The leaf nodes represent the players/teams and the internal nodes represent the matches.

    • The winner of each match is the node with the higher score.

    • Code can be written using a recursive function to traverse the tree and determine the winner.

  • Answered by AI
  • Q4. Find the 2 maximum elements in array in O(n+log(n)) comparison
  • Ans. 

    Find 2 maximum elements in array in O(n+log(n)) comparison

    • Use divide and conquer approach

    • Divide array into two halves

    • Recursively find max elements in each half

    • Compare the two max elements to find the overall max elements

  • Answered by AI
  • Q5. Celebrity Problem puzzle and write code for that
  • Q6. Given a 2D array of 0 and 1. where each row is sorted. find the row with maximum no of 1 in minimum time complexcity
  • Ans. 

    Find row with maximum 1s in a sorted 2D array of 0s and 1s.

    • Use binary search to find the first occurrence of 1 in each row.

    • Calculate the number of 1s in each row using the index found in step 1.

    • Keep track of the row with maximum number of 1s.

    • Time complexity: O(m log n), where m is the number of rows and n is the number of columns.

  • Answered by AI

Interview Preparation Tips

College Name: IIT GANDHINAGAR

Skills evaluated in this interview

SDE Interview Questions & Answers

user image Anonymous

posted on 5 Jun 2015

Interview Questionnaire 

8 Questions

  • Q1. Given an array A[n] such that A[i+1] = A[i]+1 OR A[i]-1, and a number k, find out whether k is present in A[n] or not, in most efficient way?
  • Ans. 

    Efficiently check if a number is present in an array where each element differs by 1.

    • Use binary search to find the element in the array

    • Calculate the difference between the middle element and the first element

    • If the difference is equal to the index of the middle element minus the index of the first element, then the left half of the array is consecutive

    • If the difference is not equal, then the right half of the array is ...

  • Answered by AI
  • Q2. Name any 1 microsoft product that you have been using and suggest 5 improvements in it alongwith priority assignments p1....p5
  • Ans. 

    Microsoft Excel

    • Add more chart types (p1)

    • Improve collaboration features (p2)

    • Enhance data analysis tools (p3)

    • Integrate with more external data sources (p4)

    • Improve error handling and debugging (p5)

  • Answered by AI
  • Q3. A square picture is cut into 16 squares and they are shuffled. Write a program to rearrange the 16 squares to get the original big square
  • Ans. 

    Program to rearrange shuffled 16 squares to get original big square

    • Create a 4x4 matrix to represent the big square and fill it with shuffled squares

    • Loop through the matrix and check if each square is in the correct position

    • If a square is not in the correct position, swap it with the square in the correct position

    • Repeat until all squares are in the correct position

  • Answered by AI
  • Q4. There are 9 identical Marbels out of which 1 is heavy. find out that Marbel
  • Q5. Given 3 sorted arrays, array a, b, c. find all pairs where a[i] + b[j] = c[k] note : a, b , c are sorted arrays
  • Ans. 

    Find pairs from sorted arrays a and b that sum to elements in sorted array c.

    • Use a two-pointer technique to traverse arrays a and b.

    • For each element in c, check if a[i] + b[j] equals c[k].

    • Example: a = [1, 2], b = [3, 4], c = [4, 5] results in pairs (1, 3).

    • Start with pointers at the beginning of a and b, and adjust based on the sum.

  • Answered by AI
  • Q6. What is the difference between the two declarations? int p=*(int*)i; int p=*(int*)&i;
  • Ans. 

    The first declaration casts i to int pointer and dereferences it, while the second declaration casts the address of i to int pointer and dereferences it.

    • The first declaration assumes i is already an int pointer.

    • The second declaration takes the address of i and casts it to an int pointer.

    • The first declaration may cause a segmentation fault if i is not an int pointer.

    • The second declaration may cause unexpected behavior i...

  • Answered by AI
  • Q7. Given an unsorted array of size 5. How many minimum comparisons are needed to find the median? then he extended it for size n
  • Ans. 

    Minimum comparisons needed to find median in unsorted array of size n

    • For odd n, median is the middle element. For even n, median is the average of middle two elements

    • Minimum comparisons needed for odd n is (n-1)/2. For even n, it is n/2

    • Various sorting algorithms can be used to find median in an unsorted array

  • Answered by AI
  • Q8. Given an array which is alternatively sorted. What will be the time complexity to find out an element in it. e.g. 14,3,16,6,22,7,24,11,27
  • Ans. 

    Time complexity to find an element in an alternatively sorted array.

    • The time complexity will be O(log n) using binary search.

    • Check the middle element and compare with the target element.

    • If the middle element is greater than the target, search in the left half of the array.

    • If the middle element is smaller than the target, search in the right half of the array.

    • Repeat until the target element is found or the array is exha...

  • Answered by AI

Interview Preparation Tips

Round: Technical Interview
Experience: #Given an array A[n] such that A[i+1] = A[i]+1 OR A[i]-1, and a number k, find out whether k is present in A[n] or not, in most efficient way?
#Name any 1 microsoft product that you have been using and suggest 5 improvements in it alongwith priority assignments p1....p5.
#A square picture is cut into 16 squares and they are shuffled. Write a program to rearrange the 16 squares to get the original big square.
#There are 9 identical Marbels out of which 1 is heavy. find out that Marbel.
#given 3 sorted arrays, array a, b, c.
find all pairs where a[i] + b[j] = c[k]
note : a, b , c are sorted arrays.
#What is the difference between the two declarations?
int p=*(int*)i;
int p=*(int*)&i;
#Given an unsorted array of size 5.
How many minimum comparisons are needed to find the median? then he extended it for size n.
#Given an array which is alternatively sorted. What will be the time complexity to find out an element in it.
e.g. 14,3,16,6,22,7,24,11,27

College Name: NA

Skills evaluated in this interview

Interview questions from similar companies

SDE Interview Questions & Answers

Adobe user image Anonymous

posted on 5 Jun 2015

Interview Questionnaire 

18 Questions

  • Q1. Detail questions on copy constructors were asked
  • Q2. Deep copy, shallow copy (need for explicitly writing copy constructor)
  • Ans. 

    Deep copy creates a new object with its own copies of the original's data, while shallow copy shares references to the original's data.

    • Shallow Copy: Copies the reference of an object, not the actual object. Example: `List<int> shallow = original;`

    • Deep Copy: Creates a new object and recursively copies all objects found in the original. Example: `List<int> deep = new List<int>(original);`

    • Need for Copy C...

  • Answered by AI
  • Q3. Operating system concepts such as memory Management and semaphores, critical section
  • Q4. Overloading, Overriding(Function and operator both)
  • Q5. Virtual Functions
  • Q6. Resume based interview
  • Q7. Some more discussions on virtual classes and functions, overloading, overriding, copy constructors
  • Q8. Puzzles such as no of 0s in 100!, and water- jug problem
  • Q9. Merge two double linked list. What will be the difference if they are singly linked list
  • Ans. 

    To merge two double linked lists, traverse to the end of the first list and connect it to the head of the second list.

    • Traverse to the end of the first list

    • Connect the last node of the first list to the head of the second list

    • If the lists are singly linked, we need to traverse to the end of the first list and connect it to the head of the second list. But we also need to keep track of the last node of the first list to ...

  • Answered by AI
  • Q10. Make a data structure such that it can store an image dynamically
  • Ans. 

    A dynamic data structure for storing images as arrays of strings.

    • Use a 2D array of strings to represent the image pixels.

    • Implement resizing methods to adjust the size of the image.

    • Include methods for adding, removing, and modifying pixels.

    • Consider using compression techniques to reduce memory usage.

    • Support various image formats such as JPEG, PNG, and BMP.

  • Answered by AI
  • Q11. Copy fixed no of bytes from source to destination and its test cases( ex: copy(source, destination,bytes) so now command copy(a,a+3,8) will not give correct results in some cases and copy(a,a-4,8) will n...
  • Ans. 

    Copying fixed number of bytes from source to destination and its test cases.

    • Ensure source and destination are not overlapping

    • Check if the number of bytes to be copied is greater than the available space in the destination

    • Handle cases where source or destination is NULL

    • Test cases should cover all possible scenarios including edge cases

  • Answered by AI
  • Q12. Some puzzles like weighing problem..N Balls given all of same weight except one..What is the max value of N so that u can figure out the ball with less weight in 2 rounds or 3 rounds
  • Q13. Some HR questions about family and yourself
  • Q14. Detail discussion on virtual functions
  • Q15. Optimized fibonacci program
  • Ans. 

    An optimized Fibonacci program computes Fibonacci numbers efficiently.

    • Use memoization to store previously computed values.

    • Use iterative approach instead of recursive approach.

    • Use bitwise operators to perform arithmetic operations faster.

    • Use matrix exponentiation to compute Fibonacci numbers in logarithmic time.

  • Answered by AI
  • Q16. Solution for solving problems generated by virtual functions
  • Ans. 

    Virtual functions can cause problems due to their dynamic nature, but can be solved using various techniques.

    • Use pure virtual functions to ensure all derived classes implement the function

    • Use interface classes to define a common interface for all derived classes

    • Use smart pointers to manage memory and avoid memory leaks

    • Use virtual destructors to ensure proper destruction of objects

    • Avoid excessive use of virtual function...

  • Answered by AI
  • Q17. Some good questions on compile time error check, link time error check and run time error check
  • Q18. One Image puzzle

Interview Preparation Tips

College Name: NA

Skills evaluated in this interview

Are these interview questions helpful?

SDE Interview Questions & Answers

Google user image Huiying Wang

posted on 29 Jun 2022

I applied via Recruitment Consulltant and was interviewed in Dec 2021. There were 2 interview rounds.

Round 1 - Coding Test 

45 minutes phone interview. Asked me basic java knowledge: 1, s1 = "a" + "b", s2 = "ab", s1 == s2?
2, What's Singleton design pattern?
3, Maximum CPU load

Round 2 - HR 

(1 Question)

  • Q1. I can't pass the phone call

Interview Preparation Tips

Interview preparation tips for other job seekers - prepare enough then accept actual interview

SDE Interview Questions & Answers

Zoho user image HARI RAM

posted on 5 Apr 2024

Interview experience
5
Excellent
Difficulty level
Hard
Process Duration
Less than 2 weeks
Result
Selected Selected

I applied via Job Portal and was interviewed before Apr 2023. There were 3 interview rounds.

Round 1 - Aptitude Test 

Puzzle based questions and Math problems

Round 2 - Coding Test 

Given a laptop and problem statement. Had to solve problems at eclipse.

Round 3 - Technical 

(1 Question)

  • Q1. F2F one on one technical interview

SDE Interview Questions & Answers

Adobe user image Anonymous

posted on 5 Oct 2023

Interview experience
5
Excellent
Difficulty level
-
Process Duration
-
Result
-
Round 1 - Resume Shortlist 
Pro Tip by AmbitionBox:
Don’t add your photo or details such as gender, age, and address in your resume. These details do not add any value.
View all tips
Round 2 - Aptitude Test 

DSA,COMPUTER FUNDAMENTALS

Round 3 - One-on-one 

(1 Question)

  • Q1. TELL ABOUT TREE TRAVERSALS
  • Ans. 

    Tree traversals are methods used to visit each node in a tree data structure in a specific order.

    • Inorder traversal: Visit left subtree, then root, then right subtree

    • Preorder traversal: Visit root, then left subtree, then right subtree

    • Postorder traversal: Visit left subtree, then right subtree, then root

  • Answered by AI

Skills evaluated in this interview

Microsoft Corporation Interview FAQs

How many rounds are there in Microsoft Corporation SDE interview?
Microsoft Corporation interview process usually has 1-2 rounds. The most common rounds in the Microsoft Corporation interview process are Technical, Coding Test and Resume Shortlist.
What are the top questions asked in Microsoft Corporation SDE interview?

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

  1. given a 2D array of 0 and 1. where each row is sorted. find the row with maximu...read more
  2. find the minimum no of jumps required to reach the end of array.where element a...read more
  3. Given an unsorted array of size 5. How many minimum comparisons are needed to ...read more

Tell us how to improve this page.

Overall Interview Experience Rating

3.8/5

based on 5 interview experiences

Difficulty level

Moderate 50%
Hard 50%

Duration

Less than 2 weeks 67%
4-6 weeks 33%
View more

SDE Interview Questions from Similar Companies

Google SDE Interview Questions
4.4
 • 16 Interviews
Oracle SDE Interview Questions
3.7
 • 4 Interviews
Amadeus SDE Interview Questions
3.8
 • 3 Interviews
Amdocs SDE Interview Questions
3.7
 • 2 Interviews
Adobe SDE Interview Questions
3.9
 • 2 Interviews
Zoho SDE Interview Questions
4.3
 • 1 Interview
UKG SDE Interview Questions
3.1
 • 1 Interview
View all
Microsoft Corporation SDE Salary
based on 78 salaries
₹21.2 L/yr - ₹51.6 L/yr
42% more than the average SDE Salary in India
View more details

Microsoft Corporation SDE Reviews and Ratings

based on 5 reviews

3.9/5

Rating in categories

3.8

Skill development

4.4

Work-life balance

3.7

Salary

4.8

Job security

4.3

Company culture

3.0

Promotions

3.7

Work satisfaction

Explore 5 Reviews and Ratings
Software Engineer
2.5k salaries
unlock blur

₹24.9 L/yr - ₹44 L/yr

Senior Software Engineer
1.4k salaries
unlock blur

₹35.3 L/yr - ₹73.9 L/yr

Software Engineer2
1.2k salaries
unlock blur

₹33 L/yr - ₹60 L/yr

Software Developer
1.1k salaries
unlock blur

₹24.5 L/yr - ₹45.1 L/yr

Support Engineer
607 salaries
unlock blur

₹14.3 L/yr - ₹24.5 L/yr

Explore more salaries
Compare Microsoft Corporation with

Google

4.4
Compare

Amazon

4.0
Compare

Deloitte

3.7
Compare

TCS

3.6
Compare
write
Share an Interview