Autocoder

Microsoft Interview Questions and Answers for SDE Roles

Last updated 2026-11-19

Microsoft interviews typically blend one or more coding problems with computer science fundamentals, a design or testing conversation and competency questions. This page works through that mix with model answers.

The questions are practice in the style of the topics Microsoft says it covers, not a record of past interviews.

Interviews2 to 4 conversations, up to an hour each, per Microsoft
TechnicalCoding, CS fundamentals, problem solving
Also askedCompetency questions and resume discussion
Early careerFunctional role first, team match later

How the rounds are described

Microsoft's careers site describes an application review, sometimes a short screening conversation, then interviews with potential teammates. Most processes include two to four conversations of up to an hour each, delivered by phone, Microsoft Teams or in person. Technical rounds cover problem solving, analytical thinking, computer science fundamentals and an open-ended coding problem, plus competency questions and questions about your resume.

For early-career roles, Microsoft Life says candidates are first assessed for a functional role such as software engineer, with team matching later. A 2020 Microsoft Research paper says the initial technical screen is usually by phone or an online coding platform. Treat the number of loops for your role as something to confirm with your recruiter.

Related practice

Coding problems in the style of these rounds are in Microsoft coding round questions. For the process see how to crack the Microsoft interview and how to crack the technical interview.

Hiring status

On 26 October 2026 Microsoft announced a time-limited voluntary buyout for about 60,000 eligible employees at level 70 and below, open in the US, Canada, UK and India. It followed earlier buyout and job-cut rounds in May and July 2026 and was linked in coverage to AI spending. A spokesperson said there were no plans for another buyout at the time. Microsoft has not been quoted here with any India fresher hiring number, and none is stated on this page.

See Microsoft hiring for the sourced summary, and check Microsoft's own careers site, careers.microsoft.com, for current roles.

Microsoft Interview Questions and Answers for SDE Roles: questions with worked answers

  1. 1

    Reverse a singly linked list iteratively and recursively.

    easy

    Iteratively, keep prev, cur and next: save cur.next, point cur.next at prev, then advance both pointers. Time O(n), space O(1). Recursively, reverse the rest of the list and then make head.next.next point to head and set head.next to null; this uses O(n) stack space. Interviewers often ask for the iterative version first and then the recursive one as a follow-up. Mistake: losing the rest of the list by overwriting next before saving it.

    python
    def reverse(head):
        prev = None
        while head:
            head.next, prev, head = prev, head, head.next
        return prev
    java
    class ListNode { int val; ListNode next; }
    class Solution {
        ListNode reverse(ListNode head) {
            ListNode prev = null;
            while (head != null) {
                ListNode nxt = head.next;
                head.next = prev; prev = head; head = nxt;
            }
            return prev;
        }
    }
  2. 2

    What is the difference between a process and a thread?

    easy

    A process is a running program with its own address space, file descriptors and resources. A thread is a unit of execution inside a process; threads share the process's heap, code and open files but each has its own stack and registers. Creating and switching threads is cheaper and communication is easy through shared memory, but shared data needs synchronisation to avoid race conditions, whereas a crash in one process does not take down another.

  3. 3

    Explain deadlock and how to prevent it.

    medium

    Deadlock needs four conditions at once: mutual exclusion, hold and wait, no pre-emption and circular wait. Break any one to prevent it. The most practical is to impose a global order on lock acquisition so a cycle cannot form. Others are acquiring all locks at once, using try-lock with timeout and back-off, or detecting cycles in a wait-for graph and aborting a victim. Give a two-lock example where two threads take A then B and B then A.

  4. 4

    Abstract class versus interface: when do you use each?

    medium

    An interface defines a contract that unrelated classes can implement, and a class can implement many. An abstract class shares state and partial implementation among closely related subclasses, but a class can extend only one. Use an interface for capability ('Comparable', 'Disposable'), an abstract class when subclasses share fields or common code. Also explain virtual dispatch: calling a method through a base reference runs the override chosen at runtime.

  5. 5

    Find the lowest common ancestor of two nodes in a binary search tree.

    medium

    Use the ordering. Starting at the root, if both values are smaller go left, if both are larger go right; otherwise the current node is the split point and is the answer. Time O(h), space O(1) iteratively. For a general binary tree without ordering you need a post-order search, covered in Microsoft coding round questions. Mistake: assuming a node can't be its own ancestor when one of the targets is an ancestor of the other.

    python
    def lca_bst(root, p, q):
        while root:
            if p < root.val and q < root.val: root = root.left
            elif p > root.val and q > root.val: root = root.right
            else: return root
    java
    class TreeNode { int val; TreeNode left, right; }
    class Solution {
        TreeNode lca(TreeNode root, int p, int q) {
            while (root != null) {
                if (p < root.val && q < root.val) root = root.left;
                else if (p > root.val && q > root.val) root = root.right;
                else return root;
            }
            return null;
        }
    }
  6. 6

    Write a SQL query for the second highest salary.

    medium

    Select the maximum salary that is below the overall maximum, which returns NULL if there is no second value. An alternative is DENSE_RANK() over salary descending and picking rank 2. Mention why LIMIT 1 OFFSET 1 alone fails when duplicates exist at the top: it can return the highest salary again unless you apply DISTINCT first.

  7. 7

    How would you test a vending machine, or a lift?

    medium

    Microsoft interviewers commonly ask for test cases on everyday objects to see structured thinking. Group tests: functional (correct item, correct change), boundary (exact amount, one coin short, full or empty stock), invalid input (unsupported coin, repeated button), failure and recovery (power loss mid-transaction), concurrency (two users), performance and security. Prioritise by user impact, and ask clarifying questions about what the machine is supposed to do before listing tests.

  8. 8

    How is stack memory different from heap memory?

    easy

    The stack holds function call frames, local variables and return addresses; allocation is automatic and fast, and memory is released when the function returns. The heap holds dynamically allocated objects whose lifetime is controlled by the programmer or a garbage collector; allocation is slower and can fragment. Deep recursion overflows the stack, while leaks and fragmentation are heap problems. In Java objects live on the heap and references on the stack.

  9. 9

    Sketch the design of a basic chat service with online presence.

    hard

    Clarify scale and features. Clients keep a WebSocket connection to a gateway; messages go through a message service that stores them (partitioned by conversation) and forwards to the recipient's gateway, with offline messages delivered when the client reconnects. Presence is a heartbeat updating a fast store with a short TTL. Discuss ordering per conversation, delivery acknowledgements and push notifications. See system design interview.

  10. 10

    Tell me about a time you failed and what you learned (growth mindset).

    medium

    Microsoft publicly emphasises learning and collaboration in its hiring guidance. Choose a genuine setback, say what you did wrong without blaming others, and describe the specific change you made afterwards, such as adding code review, tests or earlier check-ins. Close with how you applied the lesson later and what happened. The answer should show curiosity, not just recovery.

  11. 11

    Describe a time you worked with people outside your team to get something done.

    medium

    Show how you built agreement without authority. Name the other group, their different priority, how you found common ground (shared metric, written proposal, short demo) and the result. Microsoft's guidance says interviewers also ask competency questions and about your resume, so keep the story anchored in something you actually built and can discuss in depth.

  12. 12

    Why do you want to work at Microsoft, and what would you work on?

    easy

    Be specific and honest. Connect something you have used or built to a Microsoft product area (developer tools, cloud, productivity), say what problem there interests you, and what skills you would bring. Avoid generic praise. Since early-career candidates are often assessed for a functional role first and matched to a team later, show you can be useful across areas.

Frequently asked questions

Does Microsoft ask puzzles?

Microsoft's technical guidance emphasises problem solving and an open-ended coding problem. Structured reasoning matters more than trick answers.

How many rounds does Microsoft have?

Microsoft says most processes include two to four conversations of up to an hour. Your recruiter will give the exact plan.

Is the Microsoft interview in person or virtual?

Microsoft's site describes virtual interviewing with phone, Teams or in-person formats listed. Confirm for your role.

Where are the current openings?

See Microsoft hiring and Microsoft's own careers site.

Sources

Related guides

More in Company Interview Questions

See all in this section