Microsoft interview questions
17 questions candidates report from Microsoft interviews, plus the general HR questions every interviewer asks. Each has a model answer and the follow-ups to expect.
Typical selection process
Online coding test, then three or four interviews: data structures, problem solving, sometimes design, and a final round with a senior engineer or manager.
As reported by recent candidates. Always check the latest official notification.
34 questions
HRMotivationEasyWhy Microsoft?
Reported at Microsoft
Why Microsoft?
Reported at Microsoft
What they are checking: Motivation and awareness of what Microsoft does today.
Model answer
Microsoft builds tools that other people use to build things: Azure, GitHub, VS Code, Office. I like the idea of my work making millions of other developers and workers more productive. I use VS Code and GitHub every day, so I've seen that impact myself.
I also like the growth-mindset culture Microsoft talks about, where learning from mistakes is encouraged. That matches how I approach new problems.
And Microsoft has a large engineering presence in India, at Hyderabad and Bengaluru, working on core products rather than only support work.
BehaviouralProblem solvingHardWhat is the most technically challenging problem you have solved?
Reported at Google, Microsoft, Amazon
What is the most technically challenging problem you have solved?
Reported at Google, Microsoft, Amazon
What they are checking: Depth. They will keep asking "why" until they reach the limit of what you know, so pick something you understand completely.
Model answer
In my internship, our app's order page sometimes showed duplicate orders, roughly 1 in 500. Nobody could reproduce it locally.
I added logging with request IDs and found that duplicates always came in pairs about 300 ms apart. The mobile app retried a request whenever the network was slow, and our server processed both requests because it had no way to tell they were the same order.
I proposed an idempotency key: the app generates a unique ID per order, and the server stores it with a unique constraint in the database. A second request with the same ID returns the original order instead of creating a new one. I wrote the migration, the server change and tests that simulated the retry.
Duplicate orders went to zero over the following month. The thing I learned is to reproduce with data from production before guessing at a fix.
Likely follow-ups
- Why a database constraint and not a check in code?
- How long do you keep the idempotency keys?
- What happens if two requests arrive at exactly the same moment?
TechnicalOperating systemsEasyWhat is the difference between a process and a thread?
Reported at TCS, Infosys, Wipro, Capgemini, Microsoft
What is the difference between a process and a thread?
Reported at TCS, Infosys, Wipro, Capgemini, Microsoft
What they are checking: Basic OS understanding, often a lead-in to concurrency questions.
Model answer
A process is a running program with its own memory space. A thread is a unit of execution inside a process; all threads of a process share its memory.
- Memory: processes are isolated from each other; threads share heap memory and global data but each has its own stack.
- Cost: creating and switching between processes is more expensive than threads.
- Communication: processes need inter-process communication (pipes, sockets, shared memory); threads can simply read shared variables, which is fast but needs locks to stay correct.
- Failure: if one process crashes others keep running; a crashing thread can bring down its whole process.
Example: each Chrome tab runs as a separate process so one bad tab doesn't crash the browser, while inside a tab, separate threads handle rendering and JavaScript.
Likely follow-ups
- What is a race condition?
- What is a mutex?
TechnicalOperating systemsMediumWhat is a deadlock? What conditions cause it and how can you prevent it?
Reported at TCS, Infosys, Microsoft, Amazon
What is a deadlock? What conditions cause it and how can you prevent it?
Reported at TCS, Infosys, Microsoft, Amazon
What they are checking: Concurrency fundamentals.
Model answer
A deadlock is when two or more processes wait for each other forever. Thread A holds lock 1 and waits for lock 2, while thread B holds lock 2 and waits for lock 1.
All four conditions must hold at the same time (the Coffman conditions):
- Mutual exclusion: a resource can be held by only one process.
- Hold and wait: a process holds one resource while waiting for another.
- No preemption: resources cannot be taken away forcibly.
- Circular wait: a cycle of processes, each waiting for the next.
Prevention means breaking any one condition. The most practical is to break circular wait by always acquiring locks in a fixed global order. Other options are timeouts on lock acquisition, or acquiring all needed resources at once. Avoidance algorithms like the Banker's algorithm check that granting a request keeps the system in a safe state.
TechnicalNetworkingHardWhat happens when you type a URL into the browser and press Enter?
Reported at Google, Microsoft, Amazon, Flipkart
What happens when you type a URL into the browser and press Enter?
Reported at Google, Microsoft, Amazon, Flipkart
What they are checking: Breadth across networking, the web and browsers. Go step by step, and go deep where you are strongest.
Model answer
- URL parsing: the browser works out the protocol (https), the domain and the path.
- DNS lookup: it finds the IP address of the domain, checking the browser cache, the OS cache, the router and then the ISP's DNS resolver, which may query root, TLD and authoritative name servers.
- TCP connection: the browser opens a connection to the IP on port 443 with a three-way handshake (SYN, SYN-ACK, ACK).
- TLS handshake: browser and server agree on encryption, the server proves its identity with a certificate, and they set up session keys.
- HTTP request: the browser sends GET /path with headers such as cookies and accepted formats.
- Server side: a load balancer passes the request to an app server, which may check a cache, query a database and build the response.
- HTTP response: status code, headers and the HTML body come back.
- Rendering: the browser parses HTML into the DOM and CSS into the CSSOM, runs JavaScript, then lays out and paints the page. Extra requests are made for images, scripts and stylesheets, often from a CDN.
Interviewers usually stop you at one step and ask for more depth, most often DNS, TLS or rendering.
Likely follow-ups
- How does DNS caching work?
- What is a CDN?
- What changes with HTTP/2?
TechnicalToolsMediumWhat is the difference between git merge and git rebase?
Reported at Microsoft, Flipkart
What is the difference between git merge and git rebase?
Reported at Microsoft, Flipkart
What they are checking: Practical engineering experience.
Model answer
Both bring changes from one branch into another.
- git merge creates a new merge commit that joins the two histories. History is preserved exactly as it happened but can look tangled.
- git rebase moves your commits so they sit on top of the latest target branch, rewriting them as new commits. History becomes a clean straight line.
The rule: never rebase commits that others have already pulled, because rewriting shared history causes conflicts for everyone. A common workflow is to rebase your own feature branch on main to stay up to date, then merge it into main through a pull request.
TechnicalCodingEasyGiven an array and a target, return the indices of two numbers that add up to the target.
Reported at Amazon, Google, Microsoft, Flipkart
Given an array and a target, return the indices of two numbers that add up to the target.
Reported at Amazon, Google, Microsoft, Flipkart
What they are checking: Whether you move from the brute-force O(n²) solution to a hash map.
Model answer
Brute force checks every pair: O(n²). Better: as you scan, store each number's index in a hash map, and for each number check whether target minus that number has already been seen. O(n) time, O(n) space.
def two_sum(nums, target):
seen = {}
for i, x in enumerate(nums):
if target - x in seen:
return [seen[target - x], i]
seen[x] = i
return []
print(two_sum([2, 7, 11, 15], 9)) # [0, 1]If the array is sorted, two pointers from both ends solve it in O(n) time and O(1) space.
Likely follow-ups
- What if there are many pairs and you must return all of them?
- Solve three-sum.
TechnicalCodingMediumReverse a singly linked list.
Reported at Microsoft, Amazon, Zoho
Reverse a singly linked list.
Reported at Microsoft, Amazon, Zoho
What they are checking: Pointer manipulation, a Microsoft favourite.
Model answer
Walk the list with three pointers: prev, curr and next. At each node, point curr.next back to prev, then move all three forward. O(n) time, O(1) space.
class Node:
def __init__(self, val, next=None):
self.val = val
self.next = next
def reverse(head):
prev = None
curr = head
while curr:
nxt = curr.next
curr.next = prev
prev = curr
curr = nxt
return prevDraw the pointers on paper for a three-node list while explaining; it shows the interviewer you aren't reciting from memory. The recursive version is shorter but uses O(n) stack space.
Likely follow-ups
- Reverse the list in groups of k.
- Detect a cycle in a linked list.
TechnicalCodingEasyFind the first non-repeating character in a string.
Reported at Amazon, Flipkart, Microsoft
Find the first non-repeating character in a string.
Reported at Amazon, Flipkart, Microsoft
What they are checking: Hash map counting, and whether you notice that two passes are enough.
Model answer
Count each character in one pass, then scan again and return the first character with a count of 1. O(n) time, and O(1) extra space for a fixed alphabet.
from collections import Counter
def first_unique(s):
counts = Counter(s)
for i, ch in enumerate(s):
if counts[ch] == 1:
return i
return -1
print(first_unique("leetcode")) # 0 ('l')
print(first_unique("aabbcc")) # -1A common follow-up is a stream of characters, where you keep counts plus a queue of candidates and drop from the front of the queue whenever its count exceeds 1.
TechnicalCodingHardDesign and implement an LRU (least recently used) cache with O(1) get and put.
Reported at Amazon, Microsoft, Flipkart, Google
Design and implement an LRU (least recently used) cache with O(1) get and put.
Reported at Amazon, Microsoft, Flipkart, Google
What they are checking: Combining data structures: a hash map for lookup and a doubly linked list for order.
Model answer
Use a hash map from key to node, plus a doubly linked list ordered by recent use. On get, move the node to the front. On put, insert at the front; if over capacity, remove the node at the back and delete its key from the map. Every operation is O(1).
In Python, OrderedDict is a hash map with a linked list inside, so it shows the idea compactly:
from collections import OrderedDict
class LRUCache:
def __init__(self, capacity):
self.capacity = capacity
self.data = OrderedDict()
def get(self, key):
if key not in self.data:
return -1
self.data.move_to_end(key)
return self.data[key]
def put(self, key, value):
if key in self.data:
self.data.move_to_end(key)
self.data[key] = value
if len(self.data) > self.capacity:
self.data.popitem(last=False)Most interviewers will then ask you to write the doubly linked list yourself. Use dummy head and tail nodes so you never have to handle an empty list as a special case.
Likely follow-ups
- Write it without OrderedDict.
- How would you make it thread-safe?
- How is LFU different?
TechnicalMachine codingHardMachine coding: design a parking lot system that parks and unparks vehicles and shows free slots.
Reported at Flipkart, Amazon, Microsoft
Machine coding: design a parking lot system that parks and unparks vehicles and shows free slots.
Reported at Flipkart, Amazon, Microsoft
What they are checking: Can you build working, extensible, readable code in about 90 minutes? They judge class design, naming and whether it runs.
Model answer
Start by confirming requirements: multiple floors, slot types (bike, car, truck), park returns a ticket, unpark takes a ticket, and a command to show free slots per floor and type.
Core classes:
- Vehicle (type, registration number)
- Slot (id, floor, type, vehicle or empty)
- Ticket (id, slot, vehicle, entry time)
- ParkingLot (floors of slots, plus an active-tickets map)
- A SlotAllocationStrategy interface, so "nearest free slot" can later be swapped for another rule.
from dataclasses import dataclass, field
import itertools
@dataclass
class Slot:
floor: int
number: int
type: str
vehicle: str | None = None
@dataclass
class ParkingLot:
slots: list
tickets: dict = field(default_factory=dict)
_ids: itertools.count = field(default_factory=lambda: itertools.count(1))
def park(self, reg_no, vtype):
for slot in self.slots: # nearest-first strategy
if slot.type == vtype and slot.vehicle is None:
slot.vehicle = reg_no
ticket = f"T{next(self._ids)}"
self.tickets[ticket] = slot
return ticket
return None # lot full for this type
def unpark(self, ticket):
slot = self.tickets.pop(ticket, None)
if slot is None:
raise ValueError("Invalid ticket")
slot.vehicle = None
return slot
def free_slots(self, vtype):
return [s for s in self.slots if s.type == vtype and s.vehicle is None]To score well: get a working version early, then improve. Keep classes small, avoid hard-coded values, handle invalid input, and be ready to explain how you'd add pricing or a new vehicle type without rewriting existing code.
Likely follow-ups
- Add hourly pricing.
- How would you make free-slot lookup O(1)?
- How would this work with multiple entry gates at once?
TechnicalExperimentationMediumHow would you design an A/B test for a new checkout button?
Reported at Amazon, Flipkart, Google, Microsoft
How would you design an A/B test for a new checkout button?
Reported at Amazon, Flipkart, Google, Microsoft
What they are checking: End-to-end experimental thinking.
Model answer
- Hypothesis: a bigger, green "Buy now" button will increase checkout completion.
- Primary metric: checkout conversion rate. Guardrail metrics: refund rate, page load time, average order value, to catch harmful side effects.
- Randomisation: split users (not sessions) randomly 50/50, so the same person always sees the same version.
- Sample size: calculate it before starting from the current conversion rate, the smallest lift worth detecting (say 2%), 95% confidence and 80% power.
- Duration: run whole weeks, usually at least two, to cover weekday and weekend behaviour.
- Analysis: check the split was actually 50/50, then test for significance. Don't stop early just because the result looks significant on day 3; peeking inflates false positives.
- Decision: ship if the primary metric improves significantly and no guardrail gets worse.
Likely follow-ups
- The result is significant but the lift is 0.1%. Ship it?
- What if mobile and desktop show opposite results?
TechnicalProduct senseMediumWhat is your favourite product, and how would you improve it?
Reported at Google, Microsoft, Flipkart, Amazon
What is your favourite product, and how would you improve it?
Reported at Google, Microsoft, Flipkart, Amazon
What they are checking: Product thinking: users, problems and trade-offs, not just features you like.
Model answer
My favourite is Google Maps, specifically for commuting in Indian cities.
Why it works: it solves a daily, high-stakes problem (being late) for almost everyone, the live traffic data improves as more people use it, and features like two-wheeler mode show it was designed for Indian users, not just copied from the US.
One improvement: shared autos and local buses in tier-2 cities. In my hometown most people commute by shared auto, and Maps simply has no information on them.
- User: daily commuters in tier-2 cities without metro systems.
- Solution: let users mark shared-auto stands and routes, verified by others, as Maps already does for places.
- Success metric: increase in weekly active transit users in those cities, plus the share of route searches that end in a transit route.
- Risk: data quality. I'd launch in two cities first and only show routes confirmed by several users.
Tips
- Pick a product you actually use.
- Name a specific user segment and how you'd measure success.
TechnicalPrioritisationMediumYou have ten feature requests and capacity for three. How do you decide?
Reported at Flipkart, Microsoft
You have ten feature requests and capacity for three. How do you decide?
Reported at Flipkart, Microsoft
What they are checking: A structured, explainable framework tied to goals.
Model answer
First I check them against the team's current goal. If this quarter is about retention, a feature that brings new users ranks lower however exciting it is.
Then I score them with RICE:
- Reach: how many users it affects per month.
- Impact: how much it moves the goal for each user (3 = big, 2 = medium, 1 = low, 0.5 = minimal).
- Confidence: how sure we are of these estimates, as a percentage.
- Effort: person-months to build.
Score = Reach × Impact × Confidence ÷ Effort.
For example, a feature reaching 20,000 users, with impact 2, 80% confidence and 2 person-months, scores 16,000. Scores start the conversation, they don't end it. I'd also consider dependencies, quick wins and anything that is a legal requirement, and I'd explain to stakeholders why their request didn't make the cut.
TechnicalAnalyticalHardDaily active users of our app fell 10% this week. What do you do?
Reported at Google, Amazon, Flipkart, Microsoft
Daily active users of our app fell 10% this week. What do you do?
Reported at Google, Amazon, Flipkart, Microsoft
What they are checking: The classic root-cause question: calm, structured, hypothesis-driven.
Model answer
- Clarify: is it a sudden drop or gradual? Is it 10% compared with last week or the same week last year? How is a daily active user defined, and did that change?
- Rule out data issues: logging changes, a broken analytics SDK in a new release, delayed data.
- Check external causes: holidays, exams, a competitor launch, an outage at a cloud provider or app store.
- Segment: platform (Android/iOS/web), app version, country or city, new versus existing users, acquisition channel. If the drop is only in the latest Android version, it's probably a bug or crash.
- Walk the user journey: did app opens drop (a notification or marketing issue), or do users open but fail somewhere (a login or loading problem)?
- Check internal changes in the window: releases, experiments, pricing, notification changes.
Then I'd form a hypothesis, confirm it with data (such as crash rates for that version), fix or roll back, and set up an alert so we catch it faster next time.
TechnicalProduct designHardDesign a product that helps elderly people manage their medicines.
Reported at Google, Microsoft, Amazon
Design a product that helps elderly people manage their medicines.
Reported at Google, Microsoft, Amazon
What they are checking: The product design framework: users, needs, solutions, prioritisation, metrics.
Model answer
1. Clarify the goal: I'll assume the goal is fewer missed doses, for elderly people living alone or with working children in India. 2. Users: the elderly person (may have poor eyesight, limited smartphone skills, possibly a basic phone), the family caregiver (often in another city, worried), and the pharmacist or doctor. 3. Pain points: forgetting doses, confusing similar-looking pills, running out of medicine, family not knowing whether medicine was taken. 4. Solutions: - Voice reminders by phone call in their language, which works on any phone. - A pill box with lights for each slot that confirms when opened. - A caregiver app showing taken and missed doses, with an alert after a missed dose. - Automatic refill reminders with pharmacy delivery. 5. Prioritise: for a first version, voice-call reminders plus the caregiver app. They're cheap to build, need no new hardware and address the biggest risk, missed doses. 6. Metrics: dose adherence rate (doses confirmed out of doses scheduled), weekly active caregivers, refill orders, and retention after 90 days. 7. Risks: privacy of health data, and over-reliance; serious missed doses should prompt a call from family, not just an app notification.
HRIntroductionEasyTell me about yourself.
Tell me about yourself.
What they are checking: Can you give a short, structured story that connects your background to this job? It sets the agenda for the rest of the interview, so whatever you mention here becomes the next question.
Model answer
I'm [name], a final-year B.Tech Computer Science student at [college], graduating in 2026 with a CGPA of [8.1].
Over the last two years I have focused on backend development. My main project is a hostel complaint tracker built with Node.js and PostgreSQL that 400 students in my hostel now use. I also did a two-month internship at [company], where I wrote REST APIs and cut a slow report query from 9 seconds to under 1 second by adding the right indexes.
Outside class I solve problems on LeetCode, around 300 so far, and I coordinate our college coding club, where I run weekly contests for juniors.
I'm applying here because I want to work on systems that real users depend on, and this role gives me that from day one.
Tips
- Use present, past, future: who you are, what you have done, why this job.
- Keep it under 90 seconds. Mention only things you are happy to be questioned on.
- Do not repeat your resume line by line, and skip family details unless asked.
Likely follow-ups
- Tell me more about the complaint tracker. What was hardest?
- Why did you add indexes rather than caching?
HRSelf-awarenessEasyWhat are your strengths?
What are your strengths?
What they are checking: Whether you know what you are good at and can prove it with an example, rather than listing adjectives.
Model answer
My biggest strength is that I break unfamiliar problems into small pieces and keep going until they work.
In my second year our team had to build an attendance app using face recognition, and none of us had used OpenCV. I split the work into three parts: capturing images, training the model, and matching faces in real time. I took the matching part, read the documentation and two tutorials over a weekend, and had a working version in five days. We demoed it at the department expo and it marked attendance for a class of 60 with about 95% accuracy.
I'd bring the same habit here when I'm handed a codebase or tool I haven't used before.
Tips
- Pick one or two strengths that matter for the role.
- Every strength needs a short story with a result.
Likely follow-ups
- What would your teammates say is your strength?
- What did you do about the 5% the app got wrong?
HRSelf-awarenessMediumWhat is your greatest weakness?
What is your greatest weakness?
What they are checking: Honesty and self-improvement. They want a real weakness that will not stop you doing the job, plus what you are doing about it.
Model answer
I used to find it hard to say no when people asked for help, and I would take on more than I could finish.
In my third year I agreed to help with three club events in the same month as my mid-semester exams, and my marks in one subject dropped. Since then I have started keeping a simple weekly plan in Notion. Before I agree to something new I check it against what is already there, and if it does not fit I offer a smaller piece or a later date.
This semester I managed the coding club contest and my project deadlines without missing either. I still have to watch it, but I catch it much earlier now.
Tips
- Avoid fake weaknesses like "I'm a perfectionist" or "I work too hard".
- Never name a weakness that is core to the job, such as weak coding for a developer role.
- Spend most of the answer on what you changed.
Likely follow-ups
- Give me another weakness.
- How would you handle a manager who keeps adding work?
