Microsoft Interview Questions for Freshers: 6 Worked Examples
Six worked Microsoft fresher interview questions: graphs, DP, tries, system design, behavioral STAR, and project deep-dive, each with solutions and complexity analysis.
Microsoft’s technical interviews for freshers run three rounds of live problem-solving, not multiple-choice or aptitude tests, and each round can revisit the code you wrote in the previous one.
How the Interview Is Structured
Microsoft’s online assessment sets the stage: two coding problems in 60 minutes, with no verbal or aptitude sections. Clear that, and you enter the interview loop.
The campus interview loop runs across three stages:
- Round 1 (Technical): One or two coding problems. The interviewer watches you code and asks follow-up questions on time complexity, edge cases, and alternative approaches as you go.
- Round 2 (Technical): Harder problems, commonly from graphs or DP. May include a component-level system design question, not full distributed-systems architecture.
- Round 3 (Technical and HR): Problem-solving continues, combined with behavioral questions in the STAR format and a review of your project or internship.
The problems in rounds 2 and 3 tend to cluster at Medium-to-Hard difficulty. LeetCode’s Microsoft company tag is the most widely reported practice source among students who cleared Microsoft campus drives.
Off-campus applicants apply through Microsoft Careers India; the interview loop is structurally the same.
DSA: Three Worked Problems
Graph: Count Connected Components
- Problem: Given
nnodes and a list of undirected edges, return the number of connected components in the graph. - Approach: BFS from every unvisited node. Each traversal covers exactly one component.
- Complexity: Time
O(V + E), SpaceO(V)for the visited array and BFS queue.
from collections import deque
def count_components(n, edges):
adj = [[] for _ in range(n)]
for u, v in edges:
adj[u].append(v)
adj[v].append(u)
visited = [False] * n
count = 0
for node in range(n):
if not visited[node]:
count += 1
queue = deque([node])
visited[node] = True
while queue:
curr = queue.popleft()
for neighbor in adj[curr]:
if not visited[neighbor]:
visited[neighbor] = True
queue.append(neighbor)
return count
- Follow-up Microsoft asks: “What changes if edges are directed?” Answer: BFS still works for reachability from a given node, but connected-components semantics shift to strongly connected components, requiring Kosaraju’s or Tarjan’s algorithm.
- What the interviewer checks: Whether you state time complexity before being prompted, and whether you call out the adjacency-list choice versus an adjacency matrix.
Dynamic Programming: Longest Increasing Subsequence
- Problem: Given an integer array, return the length of its longest strictly increasing subsequence (LIS).
- DP approach: Build a table where
dp[i]= length of LIS ending at indexi. Fill it with a nested loop. TimeO(n^2), SpaceO(n). - Optimised approach: Maintain a
tailsarray using binary search (patience sorting). TimeO(n log n), SpaceO(n).
import bisect
def length_of_lis(nums):
tails = []
for num in nums:
pos = bisect.bisect_left(tails, num)
if pos == len(tails):
tails.append(num)
else:
tails[pos] = num
return len(tails)
- Follow-up Microsoft asks: “Can you reconstruct the actual subsequence, not just its length?” Answer: Yes, with a separate parent array in the
O(n^2)DP version; trace back from the maximum index. - Complexity note: State the
O(n^2)approach first. Then offer the optimised version. Interviewers in round 2 want to see whether you know both and can explain the trade-off: simpler code versus better runtime for large inputs.
Trie: Implement Prefix Search
- Problem: Design a data structure that supports two operations:
insert(word)to add a word, andstartsWith(prefix)to check whether any inserted word begins with the given prefix. - Complexity: Each operation runs in
O(m)time, wheremis the length of the word or prefix. Space scales with the number of distinct characters stored across all inserted words.
class TrieNode:
def __init__(self):
self.children = {}
self.is_end = False
class Trie:
def __init__(self):
self.root = TrieNode()
def insert(self, word):
node = self.root
for ch in word:
if ch not in node.children:
node.children[ch] = TrieNode()
node = node.children[ch]
node.is_end = True
def starts_with(self, prefix):
node = self.root
for ch in prefix:
if ch not in node.children:
return False
node = node.children[ch]
return True
- Follow-up Microsoft asks: “How would you add a
search(word)method that supports.as a wildcard matching any character?” Answer: Recursive DFS through the trie, branching at each.across all children of the current node. - What the interviewer checks: Clean node design, no global mutable state, correct handling of the empty prefix (should return True).
System Design: Fresher-Level Expectations
Microsoft does not expect freshers to architect distributed systems across multiple data centres. The typical system design question at this stage asks you to design one component and justify every data structure choice.
A common framing:
- Problem: Design a URL shortener. Users submit a long URL and receive a short code. Short codes redirect to the original URL.
- Core decisions:
- Store the mapping in a hash map, with the short code as key and the long URL as value.
- Generate the short code by applying base-62 encoding (digits 0 to 9, lowercase a to z, uppercase A to Z) to an auto-incrementing integer ID.
- Before inserting, check the hash map to avoid collision on any pre-existing code.
- Complexity: Lookup is
O(1)average (hash map). Code generation isO(1)(base-62 encode an integer). - Interviewer probe: “What happens when the ID counter reaches the limit of a 6-character base-62 code?” State that
62^6yields roughly 56 billion unique codes, so an overflow is a long-horizon problem that a fresher-level design notes but does not need to solve in the interview slot. Move on after naming it.
The same pattern applies to designing a phone directory, a task queue, or a simple key-value cache: pick a data structure, state its complexity, and pre-empt one obvious failure mode.
Behavioral: STAR with a Real Example
Microsoft’s behavioral round is short but specific. The interviewer picks one scenario, then probes the same event with four or five follow-up questions. Generic answers do not hold up past the first follow-up.
A worked STAR answer for “Tell me about a time you debugged a particularly difficult bug”:
- Situation: “In our sixth-semester database project, insert operations started timing out intermittently after the table reached around 10,000 rows.”
- Task: “I was responsible for the database layer, so I had to isolate whether the problem was in the schema, the query plan, or the connection pool.”
- Action: “I ran EXPLAIN ANALYZE on the insert queries, identified a missing index on the foreign key column, added it, and reran the test with a larger dataset to confirm the fix held.”
- Result: “Average insert time dropped from roughly 800 milliseconds to 12 milliseconds. We shipped the schema fix before the semester deadline.”
The specific numbers matter here. “Significantly faster” is a follow-up waiting to happen. “From 800 milliseconds to 12 milliseconds” closes it. The interviewer’s next question will probe whether you owned the fix or just observed it, so have a clear answer ready on what you ran, not just what you discovered.
Project Deep-Dive: What the Interviewer Is Testing
The project round is not a demo of your working application. The interviewer assumes the project works. They are testing whether you made conscious design choices or followed a tutorial step by step.
Prepare concise answers to these:
- “Why did you choose a relational database here instead of a document store?”
- “Your diagram shows a single server. Where does this architecture break first under load?”
- “If you had three more weeks, what would you change first and why?”
- “Walk me through the algorithm you used for [specific feature] in under two minutes.”
The pattern across every question: the interviewer is checking whether your answer is “the tutorial used it” or “I chose it because of specific trade-offs.” The second category of answer gets offers. Prepare one-line justifications for your top three design decisions before the interview.
What to Build Before Your Interview
Drilling LeetCode problems handles the coding round. The project deep-dive round is a separate preparation track, and it cannot be replaced by DSA practice.
Build one project where you can answer every “why” question with a specific technical reason. A URL shortener, a REST API with authentication, or a small recommendation engine covers the ground. The domain matters less than the depth of your design rationale. IT fresher roles in Chennai and similar markets weight demonstrated project depth more each year as coding screens become routine.
If your current project was built by following a course step by step, rebuild one feature from scratch with a deliberate data structure choice. TinkerLLM gives you a build environment where each exercise ships a working component, so you own the design decisions rather than inheriting them. At ₹299, it is the build layer that complements the LeetCode drilling, and it produces exactly the kind of concrete “I built this, here’s why I chose this approach” answer that the project deep-dive round rewards.
Primary sources
Frequently asked questions
How many technical rounds does Microsoft have for freshers?
Up to three technical rounds, typically. Each round includes a live coding problem followed by conceptual follow-ups on the same code. The count can vary by campus and year.
What DSA topics appear most in Microsoft fresher interviews?
Graphs (BFS/DFS), dynamic programming, and tries appear consistently. Arrays, strings, linked lists, and binary trees also feature in the online assessment round.
Does Microsoft ask system design questions to freshers?
Yes, but scoped to a single component. Freshers are not expected to design distributed systems. A typical ask is to design a cache, a rate limiter, or an API endpoint and justify the data structure choices.
What is the STAR format and how does Microsoft use it?
STAR stands for Situation, Task, Action, Result. Interviewers use it to check whether a candidate can isolate their own contribution from group work and quantify the outcome with a specific number.
What programming languages are accepted in Microsoft's interviews?
C++, Java, and Python are widely accepted. Most shortlisted candidates in Indian campus drives use C++ or Java. Python is accepted but large test cases can be tighter on runtime.
How should I prepare for Microsoft's project deep-dive round?
Review every design choice in your project. For each decision, prepare a one-line justification and a follow-up answer to how that choice would change at 10 times the current scale.
A self-paced playground for building with LLMs.
TinkerLLM is FACE Prep's sister property. A guided environment for shipping real LLM applications, the kind of project that earns a paragraph on your resume, not a line.
Try TinkerLLM (₹299 launch)