Autocoder

Mu Sigma Coding and Analytical Round Questions

Last updated 2026-11-19

Entry-level analytics rounds usually test whether you can compute carefully and reason aloud rather than whether you can write advanced algorithms. This page gives twelve practice problems in that style: Python warm-ups, SQL and pandas on small tables, two guesstimates and break-even case logic, with worked solutions, complexity where it matters and the mistakes that cost marks.

They are practice problems in the style of such rounds, not copies of any test. Use them with Mu Sigma interview questions, how to crack the SQL interview and how to crack the data analyst interview.

Languages herePython, SQL, pandas
Also coveredGuesstimates, break-even case, puzzles
LevelEasy to medium

How to approach these problems

Write the formula before any number, keep units visible, and sanity-check the answer against common sense (a market of 5 crore bottles a day in one city is a sign of a slip). In code, print intermediate results for small inputs and handle empty input explicitly.

Hiring status

We hold no sourced facts about Mu Sigma tests, drives, openings or cutoffs, so none are stated. Use the company's own careers site for current information.

Mu Sigma Coding and Analytical Round Questions: questions with worked answers

  1. 1

    Python: check whether a number is prime and list the primes up to n.

    easy

    For a single check, test divisors up to the square root: O(sqrt n). For all primes up to n, the Sieve of Eratosthenes marks multiples of each prime: O(n log log n) time, O(n) space. Mistake: testing every divisor up to n, and forgetting that 0 and 1 are not prime.

    python
    def primes_upto(n):
        if n < 2:
            return []
        sieve = [True] * (n + 1)
        sieve[0] = sieve[1] = False
        for i in range(2, int(n ** 0.5) + 1):
            if sieve[i]:
                for j in range(i * i, n + 1, i):
                    sieve[j] = False
        return [i for i, p in enumerate(sieve) if p]
    
    print(primes_upto(30))  # [2, 3, 5, 7, 11, 13, 17, 19, 23, 29]
  2. 2

    Python: the n-th Fibonacci number efficiently.

    easy

    Iterate keeping the last two values: O(n) time, O(1) space. Plain recursion is O(2^n) because it recomputes subproblems; memoisation fixes that. Mistake: starting the sequence at the wrong index; state whether F(0) is 0 or you start from 1.

    python
    def fib(n):
        a, b = 0, 1
        for _ in range(n):
            a, b = b, a + b
        return a
    
    print([fib(i) for i in range(8)])  # [0, 1, 1, 2, 3, 5, 8, 13]
  3. 3

    Python: check whether an integer is a palindrome without converting it to a string.

    easy

    Reverse the digits arithmetically with divmod and compare with the original; negatives are not palindromes. O(log n) time. Mistake: not copying the number before destroying it in the loop.

    python
    def is_palindrome(n):
        if n < 0:
            return False
        rev, m = 0, n
        while m:
            m, d = divmod(m, 10)
            rev = rev * 10 + d
        return rev == n
    
    print(is_palindrome(12321), is_palindrome(123))  # True False
  4. 4

    Puzzle in code: 100 doors, all closed. In pass k you toggle every k-th door. Which doors are open after 100 passes?

    medium

    Door n is toggled once for each divisor of n. Divisors come in pairs, except when n is a perfect square (the square root pairs with itself), so only perfect squares have an odd number of divisors and end open: 1, 4, 9, 16, 25, 36, 49, 64, 81 and 100, that is 10 doors. Simulating confirms it in O(n log n).

    python
    doors = [False] * 101
    for k in range(1, 101):
        for d in range(k, 101, k):
            doors[d] = not doors[d]
    print([i for i in range(1, 101) if doors[i]])  # perfect squares up to 100
  5. 5

    SQL: the average salary per department, listing only departments above 50,000, and the number of employees in each.

    medium

    Group by department, compute AVG and COUNT, and filter the aggregate with HAVING. Mistake: using WHERE for an aggregate condition, which is a syntax error, and counting with COUNT(salary) when NULL salaries should still count as employees.

    sql
    SELECT department, AVG(salary) AS avg_salary, COUNT(*) AS employees
    FROM employees
    GROUP BY department
    HAVING AVG(salary) > 50000
    ORDER BY avg_salary DESC;
  6. 6

    SQL: employees who earn more than the average salary of their own department.

    medium

    Compare each employee with the average of their department, either by a correlated subquery or a window function that computes the department average on every row. Mistake: comparing with the company-wide average, which answers a different question.

    sql
    SELECT name, department, salary
    FROM (
      SELECT e.*, AVG(salary) OVER (PARTITION BY department) AS dept_avg
      FROM employees e
    ) t
    WHERE salary > dept_avg;
  7. 7

    pandas: for each product category compute the mean price, then keep categories whose mean exceeds the overall mean.

    medium

    Group by category and take the mean, compute the overall mean from the original column, then filter. Mistake: taking the mean of the category means as the overall mean, which differs when categories have different sizes.

    python
    import pandas as pd
    
    df = pd.DataFrame({"cat": ["a", "a", "b", "c", "c", "c"],
                       "price": [10, 20, 40, 5, 5, 8]})
    overall = df["price"].mean()
    by_cat = df.groupby("cat")["price"].mean()
    print(by_cat[by_cat > overall])
  8. 8

    Break-even case: fixed costs are Rs 10 lakh, the price per unit is Rs 500 and the variable cost is Rs 300. How many units to break even, and what is the profit at 8,000 units?

    medium

    Contribution per unit is 500 - 300 = Rs 200. Break-even units are fixed cost divided by contribution: 10,00,000 / 200 = 5,000 units. At 8,000 units the contribution is 8,000 x 200 = Rs 16 lakh; subtract fixed costs of Rs 10 lakh for a profit of Rs 6 lakh. Follow-ups: how does break-even move if the price falls to Rs 450? Contribution becomes 150, so break-even rises to about 6,667 units.

    python
    fixed, price, var = 1_000_000, 500, 300
    contribution = price - var
    print(fixed / contribution)                  # 5000.0
    print(8000 * contribution - fixed)           # 600000
  9. 9

    Quant: a shirt marked Rs 1,000 is sold at a 20 percent discount and still makes a 25 percent profit on cost. What is the cost price?

    medium

    The selling price is 1,000 x 0.8 = Rs 800. Profit is 25 percent of cost, so selling price is 1.25 times cost and cost = 800 / 1.25 = Rs 640. Check: 640 x 1.25 = 800. Mistake: taking the profit percentage on the selling price instead of the cost, which gives 800 x 0.75 = 600 and a wrong answer.

  10. 10

    Guesstimate: the daily market for packaged drinking water bottles in a city of 5 million people.

    medium

    Assume 5 million people, and that about 30 percent buy packaged water on a given day (the rest use home filters or taps): 1.5 million buyers. Assume about 1.5 bottles each, mixing 1-litre and small bottles: about 2.25 million bottles a day. At an average of Rs 15 a bottle, that is about Rs 3.4 crore per day. Sanity check: per person about 0.45 bottles a day, plausible for an urban population with mixed habits. Name the assumption to validate first: the share who buy daily.

  11. 11

    Python: given a list of daily orders, find the longest streak of days where orders increased compared with the previous day, and the day it ended.

    hard

    Scan once with a current streak and a best streak; extend when today is greater than yesterday and otherwise reset to 1. Record the end index when the best improves. O(n) time, O(1) space. Mistake: updating the best only at the end of the loop, which misses a streak that runs to the last day.

    python
    def best_streak(a):
        best = cur = 1
        end = 0
        for i in range(1, len(a)):
            cur = cur + 1 if a[i] > a[i - 1] else 1
            if cur > best:
                best, end = cur, i
        return best, end
    
    print(best_streak([1, 2, 3, 1, 2, 3, 4, 2]))  # (4, 6)
  12. 12

    Puzzle: the average of five numbers is 20. When one is removed the average of the rest is 18. What was the number removed?

    hard

    The total of five numbers is 5 x 20 = 100. After removing one, the four remaining total 4 x 18 = 72. The removed number is 100 - 72 = 28. Generalise: removed value = n x old average - (n - 1) x new average. Check by recomputing: (72 + 28) / 5 = 20.

Frequently asked questions

What coding is needed for Mu Sigma style rounds?

Reported preparation for analytics fresher roles stresses aptitude, puzzles and light SQL or Python. Check your role description, since technical depth varies.

How should I practise guesstimates?

Pick everyday quantities, split them into factors, state assumptions and cross-check by a second route. Write them down so you can compare later attempts.

Should I learn R?

If the job description lists R, learn the basics of data frames and summary statistics. Python with pandas covers the same ground for most candidates.

Are these actual Mu Sigma questions?

No, they are practice problems in the style of such rounds, not copies of any test.

How do I avoid arithmetic mistakes?

Use round numbers, write units, and re-derive the answer a second way before moving on.

Related guides

More in Company Interview Questions

See all in this section