HireHireInterview Quizzes › Data Analyst

Data Analyst Interview Questions

Think you're ready? These are the questions that actually decide Data Analyst interviews. Warm up on Easy — then face the Hard round, where 95% of candidates crumble. 30 questions across 3 levels, instant score, completely free.

30Questions
3Difficulty levels
95%Fail the hard round
FreeInstant score
Easy
Warm-up · 10 Qs
Medium
Practical · 10 Qs
Hard
Brutal · 10 Qs
⚡ Take the Data Analyst quiz — get your score →

The Data Analyst interview questions

Below are the real questions, grouped by difficulty. Expand any one to reveal the correct answer and why — or take the timed quiz for a score you can share. Can you clear the Hard round?

Easy round 10 questions

In a SQL query, what is the difference between WHERE and HAVING clauses?
  • A. WHERE filters rows before aggregation; HAVING filters groups after aggregation ✓
  • B. HAVING filters rows before aggregation; WHERE filters after aggregation
  • C. Both are identical and interchangeable in every query
  • D. WHERE only works with JOINs; HAVING only works with subqueries
Correct answer: A. WHERE filters individual rows before GROUP BY aggregation, while HAVING filters aggregated groups afterward, so they operate at different stages.
Which SQL JOIN returns only the rows that have matching values in both tables?
  • A. LEFT JOIN
  • B. FULL OUTER JOIN
  • C. INNER JOIN ✓
  • D. CROSS JOIN
Correct answer: C. An INNER JOIN returns only rows where the join condition matches in both tables, excluding unmatched rows from either side.
You have a sales table with duplicate order rows. Which SQL keyword removes duplicate rows from a result set?
  • A. DISTINCT ✓
  • B. UNIQUE
  • C. GROUP
  • D. FILTER
Correct answer: A. The DISTINCT keyword eliminates duplicate rows from the query result, returning only unique combinations of the selected columns.
In statistics, which measure of central tendency is most robust to extreme outliers?
  • A. Mean
  • B. Median ✓
  • C. Range
  • D. Standard deviation
Correct answer: B. The median is the middle value and is unaffected by extreme outliers, unlike the mean which gets pulled toward extreme values.
In Excel, which function looks up a value in the leftmost column of a table and returns a value in the same row from a specified column?
  • A. HLOOKUP
  • B. INDEX
  • C. VLOOKUP ✓
  • D. MATCH
Correct answer: C. VLOOKUP performs a vertical lookup by searching the leftmost column and returning a value from a specified column in the same row.
A column of monthly revenue values has a few blank cells. In pandas, which method fills missing values with a specified value or strategy?
  • A. dropna()
  • B. fillna() ✓
  • C. isnull()
  • D. replace_missing()
Correct answer: B. The fillna() method replaces NaN/missing values with a specified constant or computed value, while dropna() would remove them instead.
What does a p-value of 0.03 indicate in a hypothesis test with a significance level of 0.05?
  • A. The null hypothesis is proven true
  • B. There is a 3% probability the alternative hypothesis is false
  • C. The result is statistically significant, so reject the null hypothesis ✓
  • D. The effect size is 3%
Correct answer: C. Since the p-value (0.03) is below the significance level (0.05), the result is statistically significant and the null hypothesis is rejected.
In a data visualization, which chart type is most appropriate for showing the trend of a single metric over continuous time?
  • A. Pie chart
  • B. Line chart ✓
  • C. Treemap
  • D. Scatter plot
Correct answer: B. A line chart is designed to display how a value changes over a continuous interval such as time, making trends easy to read.
In SQL, which window function assigns a unique sequential number to rows within a partition without any gaps or ties?
  • A. RANK()
  • B. DENSE_RANK()
  • C. ROW_NUMBER() ✓
  • D. NTILE()
Correct answer: C. ROW_NUMBER() assigns a distinct sequential integer to each row in a partition with no ties or gaps, unlike RANK() which can produce ties and gaps.
In data modeling for a star schema, what does a fact table typically contain?
  • A. Descriptive attributes like product names and categories
  • B. Quantitative measures and foreign keys to dimension tables ✓
  • C. Only primary keys with no numeric data
  • D. Metadata about the database schema
Correct answer: B. A fact table stores numeric measures (like sales amount) along with foreign keys linking to surrounding dimension tables in a star schema.

Medium round 10 questions

You run a SQL query joining an `orders` table (1,000 rows) to a `customers` table using a LEFT JOIN. Some orders have a `customer_id` that doesn't exist in `customers`. What happens to those orders in the result?
  • A. They are excluded from the result entirely
  • B. They appear with NULL values for the customer columns ✓
  • C. The query throws a foreign-key error
  • D. They are duplicated once per customer row
Correct answer: B. A LEFT JOIN keeps all rows from the left (orders) table, filling unmatched right-table columns with NULL.
In SQL, you want to count only the rows where `status = 'completed'` within a broader `GROUP BY region` query, while still counting all rows in another column. Which is the cleanest approach?
  • A. Use WHERE status = 'completed' for the whole query
  • B. Use COUNT(CASE WHEN status = 'completed' THEN 1 END) ✓
  • C. Use HAVING status = 'completed'
  • D. Use COUNT(DISTINCT status)
Correct answer: B. COUNT with a CASE expression counts only rows matching the condition without filtering out the rest of the group, since COUNT ignores NULLs.
A stakeholder asks for the average order value, but a few orders have extreme values (e.g., a bulk B2B order 100x the typical size). Which statistic best represents the 'typical' order for most customers?
  • A. The mean, because it uses all data points
  • B. The median, because it is resistant to outliers ✓
  • C. The mode, because it is the most frequent value
  • D. The standard deviation, because it measures spread
Correct answer: B. The median is robust to outliers and better reflects the typical value when the distribution is skewed by a few extreme orders.
In Excel, you have a lookup table with the key column in column C and the value you need in column A (to the left of the key). Using classic VLOOKUP, what is the problem?
  • A. VLOOKUP cannot handle text keys
  • B. VLOOKUP can only return values to the right of the lookup column ✓
  • C. VLOOKUP requires the table to be sorted descending
  • D. VLOOKUP is limited to 255 rows
Correct answer: B. VLOOKUP searches the first column and can only return columns to its right, so a left-side return needs INDEX/MATCH or XLOOKUP.
You have a query with both `WHERE` and `HAVING` clauses. What is the correct distinction in how they filter?
  • A. WHERE filters after aggregation; HAVING filters before
  • B. WHERE filters individual rows before grouping; HAVING filters groups after aggregation ✓
  • C. They are interchangeable and produce identical results
  • D. HAVING only works with ORDER BY
Correct answer: B. WHERE filters raw rows before GROUP BY, while HAVING filters aggregated groups after the aggregation is computed.
A dashboard shows monthly signups over two years. Which chart type is the most appropriate default for showing this trend over time?
  • A. A pie chart
  • B. A line chart ✓
  • C. A stacked bar chart of categories
  • D. A scatter plot of signups vs. random noise
Correct answer: B. A line chart is the standard choice for showing a continuous metric trending over an ordered time axis.
You compute a correlation of 0.85 between ice cream sales and drowning incidents. What is the most defensible conclusion?
  • A. Ice cream sales cause drownings
  • B. They are strongly correlated but a third factor (e.g., hot weather) likely drives both ✓
  • C. The correlation is too weak to mean anything
  • D. One variable must be lagging the other by exactly one month
Correct answer: B. Correlation does not imply causation; a confounding variable like warm weather can drive both metrics simultaneously.
In a SQL window function context, you want to rank sales per region so that ties get the same rank and the next rank skips accordingly (1, 2, 2, 4). Which function do you use?
  • A. ROW_NUMBER()
  • B. RANK() ✓
  • C. DENSE_RANK()
  • D. NTILE(4)
Correct answer: B. RANK() assigns equal ranks to ties and leaves gaps afterward, whereas DENSE_RANK() would not skip and ROW_NUMBER() never ties.
You are cleaning a dataset and find a `date` column stored as text like '2026-07-11'. Before doing time-based aggregations, what is the essential first step?
  • A. Leave it as text since it sorts correctly alphabetically
  • B. Cast/convert the column to a proper date or datetime type ✓
  • C. Replace all dashes with slashes
  • D. Split it into three separate integer columns permanently
Correct answer: B. Converting the text to a genuine date type enables reliable date arithmetic, extraction (month/year), and correct chronological operations.
A column `revenue` contains some NULL values. You run `SELECT AVG(revenue) FROM sales`. How does AVG treat the NULLs?
  • A. It treats NULLs as 0 and includes them in the average
  • B. It ignores NULL rows entirely, averaging only non-NULL values ✓
  • C. It returns NULL for the whole result
  • D. It throws a divide-by-zero error
Correct answer: B. Aggregate functions like AVG skip NULLs, dividing the sum of non-NULL values by the count of non-NULL rows only.

Hard round 10 questions

A query needs the top-3 highest-paid employees per department, with ties sharing a rank and NO gaps in the sequence. A candidate writes: SELECT * FROM ( SELECT emp_id, dept_id, salary, RANK() OVER (PARTITION BY dept_id ORDER BY salary DESC) rk FROM emp) t WHERE rk <= 3; What is the defect relative to the stated requirement?
  • A. Nothing; RANK() correctly gives gapless top-3 with shared ranks for ties
  • B. RANK() leaves gaps after ties (e.g. 1,1,3), so a tie at rank 1 drops rank 2 rows; DENSE_RANK() is required for gapless ranking ✓
  • C. The WHERE rk <= 3 is illegal because you cannot filter a window result even inside a subquery
  • D. ROW_NUMBER() should be used because RANK() cannot break ties at all
Correct answer: B. RANK() skips numbers after ties (1,1,3,...), so 'no gaps' plus 'ties share a rank' requires DENSE_RANK(); the subquery wrapper itself is correct.
You must compute a month-to-date running total of daily revenue that RESETS at the start of each calendar month. Which window specification is correct?
  • A. SUM(rev) OVER (ORDER BY d ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW)
  • B. SUM(rev) OVER (PARTITION BY DATE_TRUNC('month', d) ORDER BY d ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) ✓
  • C. SUM(rev) OVER (ORDER BY d RANGE BETWEEN INTERVAL '1 month' PRECEDING AND CURRENT ROW)
  • D. SUM(rev) OVER (PARTITION BY d ORDER BY DATE_TRUNC('month', d))
Correct answer: B. Partitioning by the truncated month restarts the running sum each month, and UNBOUNDED PRECEDING..CURRENT ROW accumulates within that partition.
On a fact table with 200M rows and a dimension with 5K rows, an analyst rewrites `WHERE status NOT IN (SELECT status FROM excluded)` where the subquery column is nullable and contains one NULL. What happens?
  • A. The query returns rows where status differs from the listed values, ignoring the NULL
  • B. The query returns zero rows because NOT IN with any NULL in the subquery makes the predicate never TRUE ✓
  • C. The optimizer silently converts NOT IN to NOT EXISTS, so the NULL is harmless
  • D. It errors out at parse time due to the NULL in the subquery
Correct answer: B. NOT IN evaluates to UNKNOWN when the list contains NULL (status <> NULL is UNKNOWN), so no row qualifies and the result is empty.
An A/B test targets a baseline conversion of 4% with a minimum detectable effect of a 0.4 percentage-point absolute lift, alpha=0.05 (two-sided), power=0.8. Traffic gives you enough users to detect only a 0.8pp lift in the planned 2 weeks. What is the correct trade-off reasoning?
  • A. Halving the MDE from 0.8pp to 0.4pp roughly quadruples the required sample size, so you must extend runtime ~4x or accept the larger MDE ✓
  • B. Halving the MDE doubles the required sample size, so a 1-week extension suffices
  • C. Lowering alpha to 0.10 will let you detect the 0.4pp effect with the same sample
  • D. Increasing power to 0.9 reduces the required sample, letting you keep 2 weeks
Correct answer: A. Required n scales with 1/MDE^2, so cutting the detectable effect in half multiplies sample size (and thus runtime) by about four.
Aggregated across a site, Variant B has a higher overall conversion than A. Split by device, A beats B on both mobile AND desktop. Which condition MOST directly produces this reversal?
  • A. A coding bug in the metric definition; segment and aggregate must always agree
  • B. Sample-ratio mismatch inflating B's denominator only in aggregate
  • C. Unequal device mix between arms acting as a confounder — B got proportionally more of the higher-converting device ✓
  • D. A Type I error caused by peeking at the results early
Correct answer: C. This is Simpson's paradox: a confounding variable (device mix) differing across arms reverses the aggregate direction versus every subgroup.
Comparing conversion counts between control and treatment (each user is 'converted' or 'not'), with ~50k users per arm, which test is the standard, correct choice?
  • A. Paired t-test on the per-user binary outcomes
  • B. Two-proportion z-test / chi-squared test of independence on the 2x2 contingency table ✓
  • C. One-way ANOVA across the two arms
  • D. Wilcoxon signed-rank test on conversion rates
Correct answer: B. Two independent groups with a binary outcome call for a two-proportion z-test (equivalently a chi-squared test on the 2x2 table); a paired test is wrong because subjects are not matched.
A p-value of 0.03 from an A/B test is reported. Which interpretation is CORRECT?
  • A. There is a 3% probability that the null hypothesis is true
  • B. If the null were true, there is a 3% chance of observing data at least as extreme as this ✓
  • C. The treatment effect is practically significant and worth shipping
  • D. There is a 97% probability the treatment is better than control
Correct answer: B. A p-value is P(data at least this extreme | null true); it is not the probability the null is true nor a statement about practical significance.
An OLS demand model shows a very high R^2, but the coefficient on 'price' flips sign and its standard error explodes when 'discounted_price' (nearly collinear with price) is added. VIF for both exceeds 30. What is the most appropriate fix given you want to keep both correlated predictors?
  • A. Drop the observation with the highest leverage to stabilize the estimates
  • B. Apply Ridge (L2) regularization, which shrinks correlated coefficients and stabilizes estimates under multicollinearity ✓
  • C. Switch to a higher-order polynomial to increase R^2 further
  • D. Use a chi-squared test to decide which predictor to drop
Correct answer: B. Ridge regression penalizes coefficient magnitude and handles multicollinearity by shrinking correlated coefficients, stabilizing estimates without forcing a variable out.
You must compute per-driver 'acceptance rate' from a trips table with statuses: requested, accepted, cancelled_by_rider_before_accept, cancelled_by_driver, completed. Which denominator gives the correct acceptance rate?
  • A. accepted / count(all rows) including cancelled_before_accept
  • B. accepted / (requests that were actually offered to the driver, i.e. excluding rider-cancelled-before-accept) ✓
  • C. accepted / completed
  • D. completed / accepted
Correct answer: B. Acceptance rate is accepted divided by requests the driver could act on; trips cancelled by the rider before the driver could accept were never offered and must be excluded from the denominator.
A gaps-and-islands problem: find consecutive-day login streaks per user. The classic trick subtracts a ROW_NUMBER() from the date. Why does `login_date - ROW_NUMBER() OVER (PARTITION BY user ORDER BY login_date)` identify a streak?
  • A. It returns the streak length directly
  • B. Within a run of consecutive dates, date and row number increment in lockstep, so their difference is constant and can be used as a GROUP BY key for each island ✓
  • C. It only works if there are no duplicate dates and the dates have gaps
  • D. It ranks the streaks so the longest gets rank 1
Correct answer: B. For consecutive dates both the date and the row number increase by 1 each step, so their difference stays constant within an island and changes at each gap, serving as a grouping key.

Prep for another role

Questions are original, written and independently verified for HireHire's role interview quizzes. They reflect the kind of knowledge Data Analyst interviews test, not any specific company's questions. HireHire maps live tech & IT jobs across India, updated regularly. Last updated: July 2026.