Microsoft interview questions & answers

20 Microsoft interview questions with full model answers — System design, Behavioral, Technical, Coding. Drawn from the same bank ChannelPulse drills from (1720 Microsoft questions in total).

BehavioralEasyMicrosoftEngineering ManagerRecruiter phone screen

1. What does your day-to-day work as an engineering manager look like?

Model answer

Situation

A strong way to answer is to explain that the role is a balance of people leadership, delivery, and technical judgment—not a calendar full of status meetings. For example: “I manage a team of eight engineers working across two product areas. Our work affects a customer-facing workflow, so reliability and predictable delivery matter alongside shipping features.” Adapt the team size, domain, and stakes to your experience.

Task

“My job is to help the team do its best work: connect priorities to the company’s goals, make progress and risks visible, and grow people without becoming a bottleneck. The balance changes day to day depending on delivery risks, team needs, and incidents.”

Action

  • “I start by checking the team’s health: current delivery risks, production signals, and any decisions blocking engineers. I use dashboards and brief conversations rather than asking for status reports that don’t help anyone.”
  • “I meet with my reports regularly for 1:1s focused on their goals, feedback, workload, and concerns. I follow up on commitments, and I make space for career development rather than treating it as an occasional exercise.”
  • “I work with product and design to clarify outcomes, scope, and sequencing. When a deadline conflicts with quality or capacity, I make the trade-off explicit—for example, reducing launch scope while protecting observability and rollback readiness.”
  • “I stay close enough to technical decisions to ask useful questions about risk, operability, and long-term cost, but I avoid taking decisions away from the engineers who own the design.”
  • “I also invest in the team’s operating system: hiring, planning, incident reviews, and removing recurring dependencies. For example, I might turn a repeated cross-team handoff delay into an agreed interface and named owners.”

Result

“In a representative quarter, that approach helped us improve delivery predictability—for example, moving from roughly 60% to 85% of planned work completed—while reducing avoidable production incidents. I’d use my actual team metrics here and explain the context, not claim that every day follows a fixed schedule. The most important signal is that the team can deliver valuable work sustainably and increasingly independently.”

What interviewers listen for

  • A realistic balance of people, product, delivery, and technical leadership.
  • Clear ownership and prioritization, not just meeting attendance.
  • Appropriate delegation and measurable team outcomes.
  • Reflection that day-to-day work changes with the team’s needs.
BehavioralEasyMicrosoft

2. Tell me about a time when you had to collaborate with a diverse team to achieve a common goal.

Model answer

Situation

In my previous role as a software engineer at a mid-sized tech company, I was part of a project team tasked with developing a new feature for our flagship product. The team was diverse, comprising members from different departments, including product management, design, and engineering, as well as from various cultural backgrounds. This diversity brought a wealth of perspectives but also posed challenges in aligning everyone towards a common goal.

Task

My specific responsibility was to ensure that the engineering team delivered the feature on time and met the quality standards. However, the key challenge was to facilitate effective collaboration among team members with different working styles and priorities, ensuring that everyone's input was valued and integrated into the final product.

Action

  • I initiated a series of cross-functional workshops to foster open communication and understanding among team members. These workshops were designed to allow each department to present their perspectives and constraints, which helped in building empathy and reducing misunderstandings.
  • To address potential conflicts, I established a shared project timeline and clear milestones. This transparency helped align everyone's expectations and provided a common framework for progress.
  • I encouraged the use of collaborative tools like shared documents and project management software, which allowed team members to contribute asynchronously and stay updated on the project's progress, regardless of their time zone or work schedule.
  • I made it a point to actively listen to each team member's concerns and suggestions, ensuring that everyone felt heard and respected. This approach not only improved team morale but also led to innovative solutions that might not have emerged in a less inclusive environment.
  • To maintain momentum, I organized regular check-ins and retrospectives, where we could celebrate small wins and address any roadblocks. This iterative feedback loop was crucial in keeping the team motivated and focused on the end goal.

Result

The project was completed on schedule and exceeded our initial quality benchmarks. The feature was well-received by users, resulting in a 15% increase in customer satisfaction ratings. Reflecting on this experience, I learned the importance of leveraging diversity as a strength and the value of creating an inclusive environment where all voices are heard. This approach not only enhances team performance but also fosters innovation and creativity.

BehavioralEasyMicrosoftEngineering ManagerManagerial Discussion

3. Why do you want to work at Microsoft?

Model answer

Situation

I’m looking for a place where engineering leadership can connect strong technical work to meaningful customer outcomes. In my current role, I’ve found that I’m most effective when I can build capable teams, work across organizational boundaries, and help turn emerging technology into dependable products—not just deliver a project in isolation.

Task

For my next role, I want to choose an environment where that combination of customer impact, technical ambition, and organizational scale is real. I’m evaluating Microsoft against those criteria, as well as against the specific team and problem this role would own.

Action

  • I’m drawn to Microsoft’s focus on helping people and organizations achieve more. For an engineering leader, that makes customer trust, accessibility, security, and reliability part of the product—not follow-up work after launch.
  • I’m particularly interested in the opportunity to apply AI in products people already use. The hard problem is not simply adding a model; it is delivering useful, grounded experiences with appropriate permissions, predictable quality, and a clear way for users to stay in control.
  • I value the “One Microsoft” opportunity: products and teams can combine capabilities across a broad ecosystem. That creates real coordination challenges, and I enjoy aligning teams around shared outcomes while preserving clear ownership.
  • I would connect that motivation to this role specifically by naming the customers, product area, and engineering challenge I’ve learned about in the interview process. I’d also explain how my experience leading [relevant team or initiative] prepares me to contribute, including one concrete outcome and what I learned from it.
  • I’m not choosing Microsoft based on brand alone. I’m looking for a role where the team’s mission, leadership expectations, and customer problem match how I do my best work.

Result

That is why Microsoft is compelling to me: it offers the possibility of combining customer-scale impact with technically challenging work and cross-team leadership. If the team’s priorities align with what we’ve discussed, I’d be excited to bring my experience building teams and delivering measurable outcomes—and to keep learning from the people around me.

What interviewers listen for

  • A specific reason for Microsoft and this team, beyond prestige.
  • A credible connection between your experience and the role’s needs.
  • Customer focus, learning mindset, and respect for trust and collaboration.
BehavioralEasyMicrosoftEngineering ManagerManagerial Discussion

4. Why are you leaving your current position?

Model answer

Situation

I’ve had a strong experience in my current position. I’ve been able to lead a meaningful engineering organization, develop managers, and deliver work that matters to customers. I’m not looking to leave because of one difficult project or a conflict; I’m considering a move because I’m ready for a different scope and a closer match to the kind of organizational challenge I want to take on next.

Task

My task is to make a thoughtful transition, not simply move away from something. I want my next role to let me apply my experience at the right level while remaining honest about what I’m seeking and respectful of my current employer.

Action

  • I’ve reflected on where I create the most impact: building strong management teams, connecting engineering strategy to customer and business outcomes, and improving how multiple teams deliver together.
  • I’ve considered what I want more of in my next role—for example, broader ownership across a product area, greater responsibility for organizational design, or a chance to scale a team through a new stage of growth. I would make that specific to the opportunity I’m interviewing for.
  • I’m evaluating roles against the actual mandate: the outcomes expected in the first year, the decision authority, the health and needs of the organization, and how engineering partners with product and the rest of the business. Title alone is not enough.
  • I’m also committed to leaving responsibly. If I make a change, I’ll align on a transition plan, document key context, and support my team and successor within appropriate boundaries.
  • I avoid criticizing individuals or sharing confidential information. If there are challenges in my current role, I describe them as context and explain what I learned, rather than presenting the next employer as a solution to every frustration.

Result

This approach has helped me be intentional about the next step and assess mutual fit, rather than treating a move as an escape. I’m interested in this opportunity because its scope and challenges appear aligned with the work where I can contribute most. I’d tailor that final sentence to the role and give a concrete reason tied to the company’s needs.

What interviewers listen for

  • A forward-looking, credible reason for exploring a change.
  • Respect for the current employer and discretion.
  • Specific alignment between your goals and the role’s actual mandate.
CodingEasyMicrosoftData ScientistTechnical Screen

5. You are given a binary classifier’s outputs on a dataset: y_true: array of true labels in ({0,1}) y_score: array of predicted scores/probabilities…

The full question

You are given a binary classifier’s outputs on a dataset:

  • y_true: array of true labels in ({0,1})
  • y_score: array of predicted scores/probabilities (higher means more likely positive)

Tasks

  1. Define precision and recall.
  2. Describe how to compute the precision–recall curve by sweeping a decision threshold over y_score.
  3. Implement (in pseudocode or Python) a function that returns PR curve points:
  • Output arrays: thresholds, precision, recall
  1. Mention at least two edge cases/pitfalls (e.g., ties in scores, no predicted positives at a threshold, extreme class imbalance).

Optional: Explain how to compute Average Precision / AUPRC and what the baseline means.

Model answer

import numpy as np

def precision_recall_curve(y_true, y_score):
    # Sort scores and corresponding true labels in descending order
    desc_score_indices = np.argsort(y_score)[::-1]
    y_true = np.array(y_true)[desc_score_indices]
    y_score = np.array(y_score)[desc_score_indices]

    # Initialize variables
    thresholds = []
    precision = []
    recall = []
    tp = 0  # True positives
    fp = 0  # False positives
    fn = np.sum(y_true)  # False negatives initially all positives

    # Iterate through scores to calculate precision and recall
    for i in range(len(y_score)):
        if i == 0 or y_score[i] != y_score[i - 1]:
            thresholds.append(y_score[i])
            precision.append(tp / (tp + fp) if (tp + fp) > 0 else 1.0)
            recall.append(tp / (tp + fn) if (tp + fn) > 0 else 0.0)

        if y_true[i] == 1:
            tp += 1
            fn -= 1
        else:
            fp += 1

    # Add the last point at threshold 0
    thresholds.append(0)
    precision.append(tp / (tp + fp) if (tp + fp) > 0 else 1.0)
    recall.append(tp / (tp + fn) if (tp + fn) > 0 else 0.0)

    return thresholds, precision, recall

# Example usage
y_true = [0, 1, 1, 0, 1]
y_score = [0.1, 0.4, 0.35, 0.8, 0.7]
thresholds, precision, recall = precision_recall_curve(y_true, y_score)
print("Thresholds:", thresholds)
print("Precision:", precision)
print("Recall:", recall)
  • Precision is the ratio of true positives to the sum of true positives and false positives. It measures the accuracy of positive predictions.
  • Recall is the ratio of true positives to the sum of true positives and false negatives. It measures the ability to find all positive samples.
  • To compute the precision-recall curve, sort y_score in descending order and iterate over it. For each unique score, calculate precision and recall, updating true positives, false positives, and false negatives accordingly.

Complexity:

  • Time: O(n log n) due to sorting, where n is the number of samples.
  • Space: O(n) for storing sorted indices and result arrays.

Edge Cases/Pitfalls:

  1. Ties in scores: Ensure that precision and recall are calculated correctly when multiple instances have the same score.
  2. No predicted positives: Handle cases where no samples are predicted as positive at a certain threshold, which can lead to division by zero in precision calculation.

Average Precision / AUPRC:

  • Average Precision (AP) is the area under the precision-recall curve. It summarizes the precision-recall trade-off across thresholds. The baseline for AP is the proportion of positive samples in the dataset.
CodingEasyMicrosoftSoftware Engineer

6. Fruits Into Baskets II (LeetCode)

Model answer

The task

Process fruit quantities in order, assigning each to the leftmost unused basket whose capacity is large enough. Count how many fruit types cannot be assigned.

Key idea

Store the maximum capacity in each segment of a segment tree. This lets us find the leftmost basket that fits a fruit and mark that basket as used in logarithmic time.

Approach

  1. Build a segment tree whose leaves hold basket capacities and whose internal nodes hold the maximum capacity in their range.
  2. For each fruit, check whether the tree’s maximum capacity is sufficient.
  3. If it is, descend the tree, preferring the left child whenever it can fit the fruit.
  4. Mark the chosen basket as used and update the maxima on the path back up.
  5. Count fruits for which no basket is available.
from typing import List

class Solution:
    def numOfUnplacedFruits(
        self, fruits: List[int], baskets: List[int]
    ) -> int:
        n = len(baskets)
        if n == 0:
            return len(fruits)

        tree = [0] * (4 * n)

        def build(node: int, left: int, right: int) -> None:
            if left == right:
                tree[node] = baskets[left]
                return

            mid = (left + right) // 2
            build(node * 2, left, mid)
            build(node * 2 + 1, mid + 1, right)
            tree[node] = max(tree[node * 2], tree[node * 2 + 1])

        def take_leftmost(node: int, left: int, right: int, need: int) -> int:
            if left == right:
                tree[node] = 0  # This basket is now used.
                return left

            mid = (left + right) // 2
            if tree[node * 2] >= need:
                index = take_leftmost(node * 2, left, mid, need)
            else:
                index = take_leftmost(node * 2 + 1, mid + 1, right, need)

            tree[node] = max(tree[node * 2], tree[node * 2 + 1])
            return index

        build(1, 0, n - 1)

        unplaced = 0
        for amount in fruits:
            if tree[1] < amount:
                unplaced += 1
            else:
                take_leftmost(1, 0, n - 1, amount)

        return unplaced

Complexity:

  • Time: O(n + m log n), where n is the number of baskets and m is the number of fruits.
  • Space: O(n) for the segment tree.

Common follow-ups

  • What if baskets can be reused? Do not remove a basket after assignment; each fruit can independently check for a fitting capacity.
  • What if we need to report the chosen basket for each fruit? Record the returned index from the tree descent.
  • Could a simple scan work? Yes, it takes O(nm) in the worst case and may be adequate for small inputs.
CodingEasyMicrosoftSoftware Engineer

7. Subtree of Another Tree (LeetCode)

Model answer

The task

Determine whether one binary tree occurs in another as a subtree: both the node values and the tree structure must match.

Key idea

Serialize each tree in preorder, recording a marker for every missing child. These markers preserve structure, so the smaller tree is a subtree exactly when its serialization appears contiguously in the larger tree’s serialization. Use KMP to search in linear time.

Approach

  1. Treat an empty candidate tree as a subtree.
  2. Serialize each tree in preorder, using None to represent missing nodes.
  3. Build the KMP prefix table for the candidate serialization.
  4. Scan the larger serialization with KMP and return whether the candidate is found.
class Solution:
    def isSubtree(self, root, subRoot):
        if subRoot is None:
            return True

        def serialize(node):
            tokens = []

            def visit(current):
                if current is None:
                    tokens.append(None)
                    return

                tokens.append(current.val)
                visit(current.left)
                visit(current.right)

            visit(node)
            return tokens

        text = serialize(root)
        pattern = serialize(subRoot)

        # Build the KMP prefix table.
        prefix = [0] * len(pattern)
        matched = 0

        for i in range(1, len(pattern)):
            while matched and pattern[i] != pattern[matched]:
                matched = prefix[matched - 1]

            if pattern[i] == pattern[matched]:
                matched += 1
                prefix[i] = matched

        # Search for the candidate serialization.
        matched = 0
        for token in text:
            while matched and token != pattern[matched]:
                matched = prefix[matched - 1]

            if token == pattern[matched]:
                matched += 1
                if matched == len(pattern):
                    return True

        return False

Complexity:

  • Time: O(n + m), where n and m are the numbers of nodes in the two trees.
  • Space: O(n + m) for the serialized tokens and KMP prefix table.

Common follow-ups

  • Can this be done without serialization? Try matching the candidate at every node; the worst case is O(nm).
  • What if many subtree queries use the same main tree? Cache a structural hash for each node, then verify matches to guard against collisions.
  • How do you avoid recursion-depth issues on skewed trees? Serialize iteratively with an explicit stack.
CodingEasyMicrosoftSoftware Engineer

8. Defuse the Bomb (LeetCode)

Model answer

The task

For each position in a circular array, compute the sum of the next k values when k is positive, or the previous |k| values when k is negative. When k is zero, every result is zero.

Key idea

Maintain the sum of the relevant circular window and update it as the position advances, rather than recalculating each sum. Split |k| into complete cycles and a remainder so the solution also handles values of k larger than the array length.

Approach

  1. Return an empty list for an empty array, and zeros when k is zero.
  2. Split |k| into complete cycles and a remainder; each complete cycle contributes the array’s total sum.
  3. Initialize the remainder window: start after the current position for positive k, or before it for negative k.
  4. Record each result and slide the window by removing the value that leaves and adding the next value.
from typing import List

class Solution:
    def decrypt(self, code: List[int], k: int) -> List[int]:
        n = len(code)
        if n == 0:
            return []
        if k == 0:
            return [0] * n

        count = abs(k)
        cycles, remainder = divmod(count, n)
        full_cycle_sum = cycles * sum(code)
        result = [0] * n

        if k > 0:
            # Initial window contains the next `remainder` values.
            window = sum(code[j % n] for j in range(1, remainder + 1))

            for i in range(n):
                result[i] = full_cycle_sum + window
                # Advance the window to the next position.
                window -= code[(i + 1) % n]
                window += code[(i + remainder + 1) % n]
        else:
            # Initial window contains the previous `remainder` values.
            window = sum(code[-j % n] for j in range(1, remainder + 1))

            for i in range(n):
                result[i] = full_cycle_sum + window
                # Advance the window to the next position.
                window -= code[(i - remainder) % n]
                window += code[i % n]

        return result

Complexity:

  • Time: O(n), since each window is initialized and updated in constant time per position.
  • Space: O(n) for the result; O(1) auxiliary space.

Common follow-ups

  • What if k is zero? Return an array of zeros.
  • What if |k| exceeds the array length? Count full cycles separately, as above.
  • Can the result be produced in place? Only if modifying the input is allowed and its original values remain available during computation.
Product & growthEasyMicrosoftProduct Manager

9. What is your favorite Microsoft product and why?

Model answer

Favorite Product: Microsoft OneNote

Why: OneNote is my favorite Microsoft product because it seamlessly integrates note-taking, organization, and collaboration. It caters to both personal and professional needs, allowing users to capture ideas, organize information, and collaborate with others in real-time.

Features I Appreciate:

  1. Cross-Platform Syncing: Ability to access notes across devices ensures continuity and flexibility.
  2. Integration with Other Microsoft Products: Enhances productivity by integrating with Outlook, Teams, and more.
  3. Organizational Tools: Sections, pages, and tags make information retrieval efficient.

Impact: OneNote has significantly improved my productivity and organization, making it an indispensable tool in my daily routine.

Product & growthMediumMicrosoftTechnical Program Manager

10. How would you answer product-management questions from the perspective of a customer?

Model answer

Clarify & scope

I would treat “from the perspective of a customer” as a request to ground product answers in real customer needs, rather than to claim that I personally represent every customer. I’d first clarify the product, decision, and customer segment. Then I’d state whose problem I’m solving and what assumptions need validation.

User segments & pain points

I’d segment by meaningful differences in needs or behavior—for example, new versus experienced users, or individual buyers versus administrators. I’d select one primary segment for the answer and describe its job to be done, current workaround, and biggest friction. I’d distinguish the end user from the buyer or operator when those roles have different goals.

Goals & success metrics

I’d define a customer outcome as the North Star—for example, the share of new users who successfully complete a core task within their first session. I’d pair that with business measures such as retention or paid conversion, and guardrails such as task errors, cancellations, support contacts, accessibility, and performance. The metric should reflect value delivered, not just clicks or feature adoption.

Solutions

I’d generate a few options: remove friction from the existing journey, provide clearer guidance or defaults, or create a more capable workflow for advanced needs. I’d compare each against customer evidence, reach, effort, and risks. Recommendation: I’d start with the smallest change that addresses the primary segment’s highest-confidence pain point, while preserving a path to support other segments if evidence warrants it.

flowchart LR
  A[Customer goal] --> B[Choose product entry point]
  B --> C[Complete core task]
  C --> D[Confirm outcome]
  D --> E[Measure success and friction]
Diagram

Prioritization & trade-offs

I’d use impact, confidence, reach, and effort to compare options, then call out who benefits and who may be disadvantaged. A customer-centric answer does not mean saying yes to every request: I’d weigh the frequency and severity of the underlying problem, strategic fit, technical cost, and risks to other customers. I’d explain what I would defer and why.

MVP, measurement & rollout

I’d validate the problem with customer interviews, support themes, usability sessions, and behavioral data. I’d launch an MVP to a representative cohort, instrument the full task funnel, and compare outcomes with a baseline or controlled test where feasible. I’d define success and stop criteria before launch, monitor guardrails, and use findings to iterate or roll back. Throughout, I’d bring customer evidence into decisions while partnering with engineering, design, data, and support on feasibility and operational readiness.

Product & growthMediumMicrosoftProduct Manager

11. Pick any physical product you really like and tell me about it.

The full question

Pick any physical product you really like and tell me about it.

For this problem we'll be using Patagonia.

Make it harder? Follow along and use Patagonia as your answer.

Model answer

Clarify & scope

I’ll pick Patagonia’s Nano Puff jacket. I like it because it’s a practical physical product that balances warmth, packability, and durability, while Patagonia’s repair and resale programs make its lifecycle part of the product experience. I’ll focus on the jacket itself and the customer experience around owning it.

User segments & pain points

The core user I have in mind is someone who hikes, travels, or commutes in changeable weather. They want a lightweight insulating layer that packs down easily, but may be unsure how warm it will be, how it fits over other layers, or whether it will last. A second important segment is environmentally conscious buyers who care about materials and what happens when the jacket wears out.

Goals & success metrics

My North Star would be customer-reported usefulness over time: the share of buyers who say the jacket remains useful after a year. I’d pair that with returns by reason, repair and resale participation, product satisfaction, and durability-related warranty claims. I’d guard against improving short-term conversion by making claims that overstate warmth or weather resistance.

Solutions

I’d consider three improvements: clearer warmth and layering guidance on the product page; a simple repair and care guide included with the jacket; and a more prominent path to repair, trade-in, or resale from the owner’s account.

Recommendation: I’d start with the product-page guidance and care information. Those changes help customers choose and use the product well without changing the jacket’s materials or adding manufacturing complexity. Patagonia already has a strong repair and resale story, so making that path easier to discover extends the product’s value beyond the initial sale.

Prioritization & trade-offs

I’d prioritize by customer impact, confidence, and effort. Better sizing, warmth, and layering guidance is likely high impact and relatively low effort. A redesigned take-back program could have meaningful long-term impact, but it requires more operational capacity and should be tested separately. I would not optimize only for units sold; a mismatch between expectations and actual performance can increase returns and undermine trust.

MVP, measurement & rollout

I’d test revised product-page guidance with a subset of traffic, then compare conversion, return rate, and return reasons against a control. I’d also ask purchasers a short follow-up question after a season of use. If the test improves confidence without increasing returns or misleading customers about performance, I’d roll it out more broadly and use the results to improve the guidance. What makes the Nano Puff compelling to me is that the product promise and the longer-term ownership experience can reinforce each other.

Product & growthMediumMicrosoftData ScientistAnalytics / experimentation round

12. Briefly explain the A/B testing and its application?

The full question

Briefly explain the A/B testing and its application? What are some common pitfalls encountered in A/B testing?

Model answer

The flow

  1. Hypothesis & Metric: Define the hypothesis and identify the key metric(s) to measure the effect.
  2. Unit of Randomization: Decide on the unit of randomization (e.g., user, session).
  3. Power/Sample Size: Calculate the required sample size to achieve statistical power.
  4. Run & Guard Against Peeking: Execute the test while preventing premature analysis.
  5. Read the Result with Guardrails: Analyze the results with statistical significance and practical significance in mind.

The answer

1. Hypothesis & Metric

  • Hypothesis: Changing the website's call-to-action button color from blue to green will increase the conversion rate.
  • Metric: Conversion rate (percentage of users who complete a desired action).

2. Unit of Randomization

  • Randomize at the user level to ensure each user sees only one version of the button.

3. Power/Sample Size

  • Assume a baseline conversion rate of 5% and a desired lift of 1%.
  • Using a power of 80% and a significance level of 5%, calculate the sample size using an online calculator or statistical software.
  • Required sample size: 10,000 users per group.

4. Run & Guard Against Peeking

  • Run the test for a predetermined period (e.g., two weeks) without checking results midway.
  • Use tools to lock the results until the test concludes.

5. Read the Result with Guardrails

  • Analyze results to determine if the change is statistically significant (p-value < 0.05).
  • Check for practical significance: Did the increase in conversion justify the change?
  • Recommendation: If statistically and practically significant, implement the green button.

Why this works

  • Hypothesis & Metric: Ensures clarity on what is being tested and how success is measured.
  • Unit of Randomization: Prevents contamination and ensures unbiased results.
  • Power/Sample Size: Guarantees that the test is capable of detecting a meaningful effect.
  • Run & Guard Against Peeking: Avoids bias and false positives by preventing premature analysis.
  • Read the Result with Guardrails: Ensures that decisions are based on both statistical and practical significance.
  • Common Pitfalls: Weak answers often fail to define a clear hypothesis, misuse metrics, or ignore the importance of sample size and statistical power.
System designEasyMicrosoft

13. Design a URL shortening service like Bitly.

Model answer

1. Requirements & scale

Functional Requirements:

  • Shorten a given URL.
  • Redirect to the original URL when a shortened URL is accessed.
  • Track the number of times a shortened URL is accessed.
  • Support custom aliases for URLs.

Non-Functional Requirements:

  • High availability and low latency.
  • Scalable to handle millions of URLs and requests.
  • Reliable redirection with minimal downtime.

Estimates:

  • Assume 100 million URLs are shortened over the system's lifetime.
  • Average URL length: 100 characters; shortened URL length: 7 characters.
  • Daily active users: 1 million, each generating 10 requests per day.
  • QPS (Queries Per Second): 1 million users * 10 requests / 86,400 seconds ≈ 115 QPS.
  • Storage: 100 million URLs * (100 + 7) characters ≈ 10.7 GB.

2. High-level architecture

flowchart TD
    subgraph Client
        A[User]
    end

    subgraph Edge/CDN
        B[CDN]
    end

    subgraph Load Balancer
        C[Load Balancer]
    end

    subgraph API / Services
        D[URL Shortening Service]
    end

    subgraph Cache
        E[Redis Cache]
    end

    subgraph Datastores
        F[SQL Database]
    end

    subgraph Workers
        G[Analytics Worker]
    end

    A -->|HTTP Request| B
    B -->|Forward Request| C
    C -->|API Call| D
    D -->|Read/Write| E
    E -->|Cache Miss| F
    D -->|Log Access| G
Diagram

3. API design

  • POST /shorten: Accepts a URL and returns a shortened URL.
  • GET /{shortUrl}: Redirects to the original URL.
  • POST /custom: Accepts a URL and a custom alias, returns a shortened URL.
  • GET /stats/{shortUrl}: Returns access statistics for a shortened URL.

4. Data model & storage

Datastore Choice:

  • Use a SQL database for ACID transactions and consistency, which is crucial for URL mappings.
  • Redis for caching frequently accessed URLs to reduce database load.

Key Tables:

  • urls:
  • id (Primary Key)
  • original_url (VARCHAR)
  • short_url (VARCHAR, Unique)
  • custom_alias (VARCHAR, Nullable)
  • access_count (INT)

Partitioning:

  • Partition the urls table by id for scalability.

5. Deep dive

The core functionality of a URL shortening service is to generate a unique short URL for each original URL. This can be achieved using a base conversion algorithm.

  1. Generate a Unique ID: Use an auto-incrementing ID from the SQL database.
  2. Convert ID to Short URL: Convert the ID to a base-62 number (using characters 0-9, a-z, A-Z) to create a short URL.
sequenceDiagram
    participant User
    participant Service
    participant DB as SQL Database
    participant Cache as Redis Cache

    User->>Service: POST /shorten {original_url}
    Service->>DB: Insert original_url, get ID
    DB-->>Service: Return ID
    Service->>Service: Convert ID to base-62
    Service->>Cache: Cache short_url -> original_url
    Service-->>User: Return short_url
Diagram

6. Scale, bottlenecks & trade-offs

Scaling:

  • Use horizontal scaling for the database and caching layers.
  • Implement read replicas for the SQL database to handle read-heavy traffic.

Bottlenecks:

  • Cache misses can lead to increased database load; ensure high cache hit rates.
  • Network latency can affect redirection speed; use CDNs to minimize latency.

Trade-offs:

  • Consistency vs. Availability: Prioritize consistency to ensure accurate URL redirection.
  • Caching Strategy: Use a write-through cache to ensure data consistency between cache and database.
  • URL Collision: Use a retry mechanism for handling collisions in custom aliases.

By focusing on these aspects, the system can efficiently handle high traffic, provide reliable URL redirection, and support additional features like custom aliases and analytics.

System designEasyMicrosoftData EngineerTechnical Screen

14. Design a highly scalable URL shortening service (like bit.ly / TinyURL) that converts long URLs into short links and supports redirection.

The full question

Design a highly scalable URL shortening service (like bit.ly / TinyURL) that converts long URLs into short links and supports redirection. Cover the architecture, data model, short-code generation, uniqueness, caching, scaling, and operational concerns below.

  1. Functional requirements
  • Provide an API to create a short URL for a given long URL.
  • Provide an API to redirect (resolve) a short code back to the original long URL.
  • The mapping must be globally unique (no unintended collisions) and reversible (given a short code, you can always retrieve the original URL via lookup).
  1. Non-functional requirements & assumptions
  • High availability and high QPS, with reads/redirects typically far outnumbering writes.
  • Support horizontal scaling across multiple instances/regions.
  • Short codes should be as short as possible (e.g., 6–10 characters) and URL-safe.
  • Low redirect latency (e.g., p95 < 50 ms); the service must tolerate partial failures.
  • State any other assumptions you need.
  1. APIs
  • Define example endpoints for creating short links and performing redirects (request/response shapes, status codes).
  1. Data model & storage
  • What you store per short link (e.g., short_code, long_url, created_at, expiry, owner_id).
  • Choice of datastore(s): KV store vs relational DB vs both, and why.
  1. Short-code generation strategy
  • Option A: hash the long URL.
  • Option B: generate globally unique IDs (e.g., Snowflake / auto-increment) and Base62-encode them.
  • How you ensure uniqueness and performance under concurrency.
  1. Guaranteeing global uniqueness across multiple instances/regions.
  2. Caching & performance
  • Use of in-memory cache (e.g., Redis) and/or CDN for hot links.
  • Cache key design, TTL, and cache-miss behavior.
  1. Scalability & reliability
  • Partitioning/sharding strategy.
  • Replication, failover, and consistency trade-offs.
  1. Operational concerns
  • Abuse prevention (rate limits), observability/metrics, link expiration, and analytics logging (optional).
  1. Follow-up: If you use a hash of the long URL to generate the short code, how do you detect and handle hash collisions? Provide at least two approaches and their trade-offs.

Model answer

1. Requirements & scale

Functional Requirements:

  • API to create a short URL for a given long URL.
  • API to redirect a short code back to the original long URL.
  • Mapping must be globally unique and reversible.

Non-Functional Requirements:

  • High availability and high QPS, with reads/redirects far outnumbering writes.
  • Support horizontal scaling across multiple instances/regions.
  • Short codes should be 6–10 characters, URL-safe.
  • Low redirect latency (p95 < 50 ms) and tolerance for partial failures.

Estimates:

  • Assume 1 million users, each generating 10 links/month.
  • QPS: 1 million links / 30 days / 24 hours / 60 minutes / 60 seconds ≈ 1.16 QPS.
  • Storage: Each URL mapping takes ~200 bytes. For 1 million links, ~200 MB storage required.

2. High-level architecture

flowchart TD
    subgraph Client
        A["User Interface"]
    end

    subgraph Edge/CDN
        B["CDN"]
    end

    subgraph Load_Balancer
        C["Load Balancer"]
    end

    subgraph API_Services
        D["API Gateway"]
        E["Short URL Service"]
        F["Redirect Service"]
    end

    subgraph Cache
        G["In-Memory Cache (Redis)"]
    end

    subgraph Datastores
        H["NoSQL Database (DynamoDB)"]
    end

    subgraph Message_Queue
        I["Message Queue (Kafka)"]
    end

    A -->|Create Short URL| C
    A -->|Redirect| C
    C -->|API Requests| D
    D -->|Create Short URL| E
    D -->|Redirect| F
    E -->|Store Mapping| H
    F -->|Lookup Mapping| H
    F -->|Cache Lookup| G
    G -->|Cache Miss| I
Diagram

3. API design

Endpoints:

  1. Create Short URL - Method: POST - Path: /api/shorten - Request Body: { "long_url": "http://example.com" } - Response: { "short_code": "abc123", "long_url": "http://example.com" } - Status Codes: 201 Created, 400 Bad Request
  2. Redirect to Long URL - Method: GET - Path: /api/redirect/{short_code} - Response: { "long_url": "http://example.com" } - Status Codes: 302 Found, 404 Not Found

4. Data model & storage

Data Model:

  • short_code: Unique identifier for the short URL.
  • long_url: Original long URL.
  • created_at: Timestamp of creation.
  • expiry: Optional expiration date.
  • owner_id: Optional user identifier.

Datastore Choice:

  • NoSQL Database (DynamoDB): For scalability and flexibility with schema.
  • In-Memory Cache (Redis): For fast access to frequently used short URLs.

5. Short-code generation strategy

Option B: Generate Globally Unique IDs

  • Use a unique ID generator (e.g., Snowflake) and Base62 encode it.
  • Ensures uniqueness across distributed instances.

Concurrency Handling:

  • Use atomic operations in the database to ensure no collisions occur during writes.

6. Guaranteeing global uniqueness

  • Use a centralized service for ID generation (e.g., Snowflake) to ensure unique IDs across instances.
  • Implement a distributed lock mechanism or database transactions to prevent race conditions.

7. Caching & performance

In-Memory Cache:

  • Use Redis to cache frequently accessed short URL mappings.
  • Cache Key Design: short_code as the key.
  • TTL: Set to 1 hour for hot links.
  • Cache Miss Behavior: On a cache miss, fetch from the database and update the cache.

8. Scalability & reliability

Partitioning/Sharding Strategy:

  • Use hash-based sharding on short_code to distribute load across multiple database instances.

Replication & Failover:

  • Implement multi-region replication for the database.
  • Use a failover mechanism to switch to a backup instance in case of failure.

Consistency Trade-offs:

  • Prioritize availability over consistency (eventual consistency model).

9. Operational concerns

  • Abuse Prevention: Implement rate limiting on API endpoints.
  • Observability/Metrics: Monitor API usage and response times using tools like Prometheus.
  • Link Expiration: Allow users to set expiration dates for short links.
  • Analytics Logging: Track click-through rates and user engagement.

10. Handling hash collisions

Approach 1: Linear Probing

  • If a collision occurs, incrementally check the next available slot until an empty one is found.
  • Trade-off: Simple but may lead to performance degradation under high load.

Approach 2: Hashing with a Salt

  • Append a random salt to the long URL before hashing to reduce collision probability.
  • Trade-off: Increases complexity and requires storage for the salt but significantly reduces collision chances.
System designMediumMicrosoftAI EngineerLow-level design

15. Low-level design: sketch the classes and interfaces for the tool-calling layer of an agent host, where tools can come from native code, an OpenAPI…

The full question

Low-level design: sketch the classes and interfaces for the tool-calling layer of an agent host, where tools can come from native code, an OpenAPI spec, or an MCP server.

Model answer

Start from the seam. A tool is four things: a name, a description the model reads, a parameter schema, and something to invoke. Everything else is policy layered on top.

Core types:

  • ToolDefinition - immutable value object holding name, description, JSON Schema for parameters, optional result schema. Immutable because it is shared across threads and serialised into every prompt.
  • ITool - ToolDefinition Definition { get; } plus Task<ToolResult> InvokeAsync(ToolCall call, ToolContext ctx, CancellationToken ct). Deliberately narrow: one property, one method.
  • ToolResult - a success/error union rather than thrown exceptions. The error text is fed back to the model for a corrective retry, so it has to be structured and safe to show: no stack traces, no connection strings.
  • ToolContext - caller identity, tenant, correlation id, remaining budget and deadline. Passing identity explicitly instead of reading ambient state is what makes "the tool runs as the user, never as the service" testable.
  • IToolProvider - discovery plus a factory for handlers. One adapter per source: reflection over annotated methods, an OpenAPI parser, an MCP client. A new integration is a new provider, and the orchestration loop never changes.
  • ToolRegistry - resolves names, namespaces them by provider so two sources can both ship a search, and hands each session a filtered view, meaning the allowlist for that agent rather than the global set.

Cross-cutting concerns go in decorators over ITool, not in a base class: timeout, retry, rate limit, audit log, and a RequiresApproval wrapper that returns a pending result for the host to surface to the user. Decorators compose in a declared order and each is unit-testable against a fake inner tool. The invoker validates arguments against the schema before dispatch, so a hallucinated parameter fails cheaply instead of halfway through a side effect.

Worth sketching. How one narrow interface plus decorators lets three unrelated tool sources share a single execution path.

flowchart LR
    A["Providers: native,<br/>OpenAPI, MCP"] --> B["ToolRegistry<br/>(namespaced)"]
    B --> C["Per-session allowlist"]
    C --> D["Decorators: timeout,<br/>retry, audit, approval"]
    D --> E["ITool.InvokeAsync"]
    E --> F["ToolResult<br/>(success or error)"]
    F -->|"error fed back"| G["Agent loop"]
Diagram

Follow-ups: Two providers register a tool called search. How does the registry resolve that, and what name does the model actually see? Where does per-user permission enforcement belong: the tool, a decorator, or the downstream service?

System designMediumMicrosoftDevOps / SRE

16. What are the differences between stateful and stateless applications?

Model answer

1. Definition

  • Stateful Applications: These applications maintain state across user sessions. They remember previous interactions and store user data, which allows for continuity in user experience.
  • Stateless Applications: These applications do not retain session information. Each request is treated as an independent transaction, with no memory of past interactions.

2. Characteristics

  • Stateful:
  • Requires session management.
  • Can provide a personalized experience.
  • More complex to scale due to state retention.
  • Stateless:
  • No session management required.
  • Simpler architecture, easier to scale.
  • Each request is independent, leading to potential redundancy in data transmission.

3. Use Cases

  • Stateful Applications:
  • Online gaming, where user progress is saved.
  • Shopping carts in e-commerce platforms, retaining selected items across sessions.
  • Stateless Applications:
  • RESTful APIs, where each request is self-contained.
  • Web servers that serve static content without user-specific data.

4. Advantages & Disadvantages

  • Stateful Advantages:
  • Enhanced user experience due to continuity.
  • Better suited for applications needing user context.
  • Stateful Disadvantages:
  • Complexity in scaling and managing sessions.
  • Increased resource consumption due to state retention.
  • Stateless Advantages:
  • Easier to scale horizontally.
  • Lower resource consumption since no state is stored.
  • Stateless Disadvantages:
  • May require more data to be sent with each request.
  • Less personalized user experience.

5. Conclusion

In summary, the key difference between stateful and stateless applications lies in how they manage user state. Stateful applications provide a continuous experience by retaining session information, while stateless applications simplify scaling and management by treating each request independently. Understanding these differences is crucial for designing efficient and effective applications based on specific use cases.

TechnicalEasyMicrosoftData ScientistTechnical screen

17. Three friends in Seattle each told you it’s rainy, and each person has a 1/3 probability of lying.

The full question

Three friends in Seattle each told you it’s rainy, and each person has a 1/3 probability of lying. What is the probability that Seattle is rainy? Assume the probability of rain on any given day in Seattle is 0.25.

Model answer

The flow

  1. Identify the distributions/assumptions: Use Bayes' Theorem.
  2. Write the formula: Express the probability using Bayes' Theorem.
  3. Compute the probabilities: Calculate using given probabilities.
  4. State implications: Discuss what the result implies.
  5. Identify where it breaks: Consider assumptions and limitations.

The answer

1. Identify the distributions/assumptions

  • We assume that each friend's statement is independent and that they have a 1/3 probability of lying.
  • The prior probability of rain in Seattle is 0.25.

2. Write the formula

  • Use Bayes' Theorem to find the probability that it is rainy given that all three friends say it is rainy: $$ P(\text{Rain} | \text{All say Rain}) = \frac{P(\text{All say Rain} | \text{Rain}) \cdot P(\text{Rain})}{P(\text{All say Rain})} $$

3. Compute the probabilities

  • Calculate $P(\text{All say Rain} | \text{Rain})$: Each friend tells the truth with probability $2/3$. $$ P(\text{All say Rain} | \text{Rain}) = \left(\frac{2}{3}\right)^3 = \frac{8}{27} $$
  • Calculate $P(\text{All say Rain} | \text{No Rain})$: Each friend lies with probability $1/3$. $$ P(\text{All say Rain} | \text{No Rain}) = \left(\frac{1}{3}\right)^3 = \frac{1}{27} $$
  • Calculate $P(\text{All say Rain})$ using the law of total probability: $$ P(\text{All say Rain}) = P(\text{All say Rain} | \text{Rain}) \cdot P(\text{Rain}) + P(\text{All say Rain} | \text{No Rain}) \cdot P(\text{No Rain}) $$ $$ = \frac{8}{27} \cdot 0.25 + \frac{1}{27} \cdot 0.75 = \frac{2}{27} + \frac{0.75}{27} = \frac{2.75}{27} $$
  • Calculate $P(\text{Rain} | \text{All say Rain})$: $$ P(\text{Rain} | \text{All say Rain}) = \frac{\frac{8}{27} \cdot 0.25}{\frac{2.75}{27}} = \frac{2}{2.75} \approx 0.727 $$

4. State implications

  • The probability that it is rainy given that all three friends say it is rainy is approximately 72.7%.

5. Identify where it breaks

  • Assumes independence of friends' statements.
  • Assumes the probability of lying is accurate and consistent.
  • Assumes the prior probability of rain is accurate.

Why this works

  • Tests understanding of Bayes' Theorem: Evaluates ability to apply it to real-world scenarios.
  • Sanity check: Ensures the calculated probability is logical given the prior and likelihood.
  • Common pitfalls: Weak answers might ignore independence or miscalculate probabilities.
  • Assumptions: A strong answer acknowledges and questions the assumptions made.
TechnicalEasyMicrosoftGroup Product Manager

18. What have you been responsible for in your current product management role?

Model answer

A strong answer should make your scope legible, not just list activities. Adapt the example below with your real portfolio, metrics, and decisions; do not claim a team or result you cannot substantiate.

Scope and mandate

“In my current role, I’m accountable for [product area or portfolio], serving [primary customer segments]. My scope includes the product strategy and roadmap, outcomes across [key journeys or products], and alignment with [engineering, design, data, sales, operations, or other teams]. The business problem we’re solving is [customer problem and why it matters now].”

What I own day to day

“I translate company goals into a small set of measurable product outcomes. For example, I own [North Star or business outcome], with leading indicators such as [activation, adoption, task success, or retention] and guardrails such as [quality, cost, risk, or customer support burden]. I use customer research, product data, and input from go-to-market teams to identify opportunities, then make explicit roadmap choices about what we will—and will not—do.”

How I operate at Group PM level

“I lead through a team of [PMs or product leads] and partner with [number or types of cross-functional teams]. I set direction and decision principles, coach PMs on problem framing and execution, and resolve dependencies or priority conflicts that individual teams cannot solve alone. A concrete example is [brief example of a portfolio trade-off]: I aligned [stakeholders] around [customer and business evidence], chose [option] over [alternative], and clarified how we would measure whether the decision worked.”

Results and learning

“Over [time period], we moved [metric] from [baseline] to [result], while [guardrail] stayed within [threshold]. The impact was [customer, revenue, cost, or organizational result]. I also learned [specific lesson], which changed how I now [make decisions, structure teams, or sequence work].”

What interviewers listen for

  • Clear ownership boundaries and portfolio scale—not just meeting attendance or feature delivery.
  • A link from strategy to customer outcomes, business results, and measurable guardrails.
  • Evidence of prioritization, influence across functions, and developing other product leaders.
  • Specific results with baselines, timeframes, and honest attribution.
TechnicalEasyMicrosoftDesign Manager

19. Are you actively vibe coding?

Model answer

Yes—selectively. I use AI coding tools to turn a design question into a testable prototype faster, especially when the question is about interaction, layout, or whether a concept is worth exploring. I don’t treat generated code as production-ready or use it as a substitute for engineering partnership.

  1. Start with the question. I define what I need to learn, such as whether users understand a new navigation model, before choosing a tool. A prototype should answer a decision, not just demonstrate that I can generate an interface.
  2. Constrain the experiment. I use synthetic or approved data, a small scope, and an existing design system where possible. I avoid entering confidential customer information or proprietary code into tools that have not been approved.
  3. Review the output. I check accessibility, responsive behavior, interaction states, privacy implications, and whether the implementation matches the intended design. I label rough prototypes clearly so nobody mistakes them for a shippable product.
  4. Bring the learning back to the team. If the prototype validates an idea, I document what we learned and partner with engineering to assess feasibility, architecture, and production requirements. If it does not, I use that evidence to stop or revise the direction.
flowchart LR
    A[Design question] --> B[Small AI-assisted prototype]
    B --> C[Review risks and fidelity]
    C --> D[User or team evaluation]
    D --> E[Engineering handoff or iteration]
Diagram

As a Design Manager, I’d encourage responsible experimentation while setting clear guardrails: approved tools, no sensitive data, human review, and transparent labeling. I’d also look at whether the practice improves learning speed or collaboration—not count prototypes as productivity. The trade-off is speed versus reliability: AI can reduce setup time, but it can also introduce inaccessible patterns, brittle code, or false confidence. My standard is that it must help the team make a better decision, not merely make a demo faster.

TechnicalEasyMicrosoft

20. What is the difference between a stack and a queue?

Model answer

Difference between a Stack and a Queue

  1. Data Structure Type: - Stack: A stack is a linear data structure that follows the Last In, First Out (LIFO) principle. This means that the last element added to the stack will be the first one to be removed. - Queue: A queue is a linear data structure that follows the First In, First Out (FIFO) principle. This means that the first element added to the queue will be the first one to be removed.
  2. Operations: - Stack: - Push: Adds an element to the top of the stack. - Pop: Removes the element from the top of the stack. - Peek/Top: Retrieves the top element without removing it. - Queue: - Enqueue: Adds an element to the end of the queue. - Dequeue: Removes the element from the front of the queue. - Front/Peek: Retrieves the front element without removing it.
  3. Use Cases: - Stack: Used in scenarios like undo mechanisms in text editors, parsing expressions (e.g., evaluating postfix expressions), and maintaining function calls (call stack). - Queue: Used in scenarios like scheduling tasks, managing requests in web servers, and breadth-first search (BFS) in graph algorithms.
  4. Implementation: - Stack: Can be implemented using arrays or linked lists. The operations are typically O(1) due to direct access to the top element. - Queue: Can be implemented using arrays, linked lists, or circular buffers. Operations like enqueue and dequeue are typically O(1) when implemented efficiently.
  5. Memory Access: - Stack: Access is limited to the top element, making it suitable for scenarios where only the most recent data is needed. - Queue: Access is limited to the front element, making it suitable for scenarios where the oldest data needs to be processed first.

Understanding these differences helps in choosing the appropriate data structure based on the specific requirements of the problem at hand.

Practice these out loud, don't memorise them

Reading an answer is not the same as being able to give one under pressure. ChannelPulse plays the interviewer, asks the follow-ups, and scores each answer with feedback and a model answer so you can hear the gap between what you said and what lands.

Get ChannelPulse Browse all questions