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. 80 questions across 3 levels, instant score, completely free.

80Questions
3Difficulty levels
95%Fail the hard round
FreeInstant score
Easy
Warm-up · 20 Qs
Medium
Practical · 30 Qs
Hard
Brutal · 30 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 20 questions

You run an INNER JOIN between Orders and Customers on customer_id. An order has a customer_id that does not exist in Customers. What happens to that order row?
  • A. It appears with NULLs for customer columns
  • B. It is excluded from the result ✓
  • C. It causes the query to error out
  • D. It appears duplicated once per customer
Correct answer: B. INNER JOIN returns only rows with a match on both sides, so an unmatched order is dropped.
A dataset of salaries is [30k, 32k, 34k, 35k, 2,000k]. Which measure best represents the 'typical' salary here?
  • A. Mean, because it uses all values
  • B. Median, because it resists the outlier ✓
  • C. Mode, because it is most frequent
  • D. Range, because it shows the spread
Correct answer: B. The extreme 2,000k value inflates the mean, so the median better reflects the typical value.
You want the total sales per region but only regions whose total exceeds 1,00,000. Where does the total-based condition go?
  • A. In a WHERE clause
  • B. In a HAVING clause ✓
  • C. In the ON clause
  • D. In the SELECT list
Correct answer: B. WHERE filters individual rows before grouping; conditions on an aggregate use HAVING after GROUP BY.
A column 'discount' has some NULL values. What does AVG(discount) do with those NULLs?
  • A. Treats them as 0 in the average
  • B. Ignores them entirely ✓
  • C. Returns NULL for the whole result
  • D. Raises a divide-by-zero error
Correct answer: B. Aggregate functions like AVG skip NULLs, averaging only the non-NULL values.
You need to show how monthly revenue changed across a year. Which chart communicates this best?
  • A. Pie chart
  • B. Line chart ✓
  • C. Stacked bar of categories
  • D. Scatter plot
Correct answer: B. A line chart is designed to show a continuous trend over time.
SELECT COUNT(*) returns 100, but SELECT COUNT(email) returns 92 on the same table. What does this tell you?
  • A. 8 rows have duplicate emails
  • B. 8 rows have NULL emails ✓
  • C. 8 rows have empty-string ('') emails
  • D. COUNT(email) counted only unique emails
Correct answer: B. COUNT(column) ignores NULLs, so the gap of 8 means 8 rows have a NULL email.
A sales figure rose from 200 to 250. What is the percentage increase?
  • A. 20%
  • B. 25% ✓
  • C. 50%
  • D. 125%
Correct answer: B. (250-200)/200 = 50/200 = 25%.
You find that ice-cream sales and drowning incidents both rise together each summer. What is the safest conclusion?
  • A. Ice cream causes drownings
  • B. Drownings cause ice-cream sales
  • C. Both are likely driven by a third factor (hot weather) ✓
  • D. The data must be wrong
Correct answer: C. Correlation does not imply causation; a common cause like temperature explains both.
A LEFT JOIN of Customers (left) to Orders (right) is run. A customer placed no orders. What appears for that customer?
  • A. The customer is omitted
  • B. One row with NULLs in the order columns ✓
  • C. An error, since there is no match
  • D. The customer row repeated twice
Correct answer: B. LEFT JOIN keeps every left row; unmatched right-side columns are filled with NULL.
You add DISTINCT to SELECT city FROM customers. What is the effect on the output?
  • A. It sorts cities alphabetically
  • B. It returns each city name only once ✓
  • C. It counts how many cities exist
  • D. It removes rows with NULL city
Correct answer: B. DISTINCT collapses duplicate values so each unique city is listed once.
In Excel, VLOOKUP with range_lookup set to FALSE (exact match) cannot find the lookup value. What is returned?
  • A. The nearest smaller value
  • B. 0
  • C. #N/A ✓
  • D. A blank cell
Correct answer: C. An exact-match VLOOKUP that finds nothing returns the #N/A error.
A WHERE clause reads: WHERE country = 'India' OR country = 'Nepal' AND status = 'active'. Given operator precedence, which rows match?
  • A. Active customers in India or Nepal
  • B. All India rows, plus active Nepal rows ✓
  • C. Only active rows in India and Nepal
  • D. All India and all Nepal rows
Correct answer: B. AND binds tighter than OR, so it reads: India (any status) OR (Nepal AND active).
You import a CSV and a date column '2026-07-11' is stored as text. Why is this a problem for analysis?
  • A. It takes more storage
  • B. You cannot sort or do date math correctly ✓
  • C. It forces every other column in the row to become text too
  • D. It breaks primary keys
Correct answer: B. As text, dates sort lexically and don't support interval calculations, so they must be cast to a date type.
A table should have one row per order, but you find some order_ids appear twice. Before computing total revenue, what should you do?
  • A. Sum everything as-is
  • B. Investigate and remove the duplicate rows ✓
  • C. Add DISTINCT to the SELECT to hide the duplicates
  • D. Keep the duplicates but divide the final total by 2
Correct answer: B. Duplicate rows double-count revenue, so they must be identified and de-duplicated first.
ORDER BY sales DESC is added to a query. How are the rows arranged?
  • A. Lowest sales first
  • B. Highest sales first ✓
  • C. Alphabetically by sales
  • D. In insertion order
Correct answer: B. DESC sorts from largest to smallest, so the highest sales appear first.
You have wide data with columns Jan, Feb, Mar as separate sales columns and need it in 'long' format for a BI tool. What transformation is this?
  • A. Aggregating
  • B. Unpivoting (melting) ✓
  • C. Joining
  • D. Filtering
Correct answer: B. Turning multiple columns into month/value rows is unpivoting, also called melting.
GROUP BY region is used with SELECT region, SUM(amount). What does each output row represent?
  • A. One original transaction
  • B. One region with its combined total ✓
  • C. One customer
  • D. One randomly chosen row per region
Correct answer: B. GROUP BY collapses rows per region, and SUM aggregates the amounts within each group.
A KPI dashboard shows 'conversion rate'. If 50 of 2,000 visitors purchased, what is it?
  • A. 0.25%
  • B. 2.5% ✓
  • C. 4%
  • D. 25%
Correct answer: B. 50/2000 = 0.025 = 2.5%.
You must join two tables reliably. Which column is the best join key?
  • A. A free-text name column
  • B. A unique, non-null id column ✓
  • C. A date column
  • D. A monetary amount column
Correct answer: B. A unique non-null identifier avoids ambiguous or missing matches, unlike names or amounts.
A boxplot of delivery times shows several points far above the upper whisker. What are these points?
  • A. The median values
  • B. Potential outliers ✓
  • C. The interquartile range
  • D. Missing values
Correct answer: B. Points beyond the whiskers are flagged as potential outliers.

Medium round 30 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 only works within a single worksheet
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 signup count vs. month index
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.
You need every customer listed even if they have no orders, plus order details where they exist. Which join achieves this with customers as the left table?
  • A. INNER JOIN
  • B. RIGHT JOIN
  • C. LEFT JOIN ✓
  • D. CROSS JOIN
Correct answer: C. A LEFT JOIN keeps all rows from the left (customers) table and fills NULLs where no matching order exists.
In SQL, why does WHERE fail when filtering on the result of an aggregate like COUNT(*), and what clause is needed instead?
  • A. WHERE runs after aggregation; use ORDER BY
  • B. WHERE runs before aggregation; use HAVING ✓
  • C. WHERE cannot use columns; use SELECT
  • D. WHERE only works on text; use LIKE
Correct answer: B. WHERE filters rows before grouping/aggregation, so aggregate conditions must go in HAVING, which runs after GROUP BY.
A dataset of salaries is heavily right-skewed. Which summary best represents a typical salary?
  • A. The mean, since it uses all data
  • B. The median, since it resists skew ✓
  • C. The maximum value
  • D. The standard deviation
Correct answer: B. The median is robust to right-skew and better reflects the typical value than the outlier-inflated mean.
In Excel, what does the formula =COUNTIFS(A:A,">100",B:B,"India") return?
  • A. Sum of column A where B is India
  • B. Count of rows where A>100 and B equals India ✓
  • C. Count of rows where A>100 or B equals India
  • D. Average of A where B is India
Correct answer: B. COUNTIFS counts rows meeting ALL supplied criteria, here A greater than 100 AND B equal to India.
Which SQL window function assigns a unique sequential number to rows with no gaps, but gives ties different numbers?
  • A. RANK()
  • B. DENSE_RANK()
  • C. ROW_NUMBER() ✓
  • D. NTILE()
Correct answer: C. ROW_NUMBER() always produces distinct consecutive integers, even for tied values, unlike RANK or DENSE_RANK.
You compute month-over-month growth. Which pandas operation gives the percentage change from the previous row?
  • A. df['sales'].diff()
  • B. df['sales'].pct_change() ✓
  • C. df['sales'].cumsum()
  • D. df['sales'].rolling(2).mean()
Correct answer: B. pct_change() computes the fractional change between each element and its predecessor, i.e., period-over-period growth.
A correlation coefficient between ad spend and sales is 0.85. What can you correctly conclude?
  • A. Ad spend causes higher sales
  • B. There is a strong positive linear association, not necessarily causation ✓
  • C. Sales cause ad spend
  • D. There is no relationship
Correct answer: B. Correlation measures linear association only; a high value does not establish causation or its direction.
In a star schema, which statement best describes a fact table?
  • A. It stores descriptive attributes like product name and category
  • B. It stores measurable, quantitative events with foreign keys to dimensions ✓
  • C. It stores only unique keys with no measures
  • D. It replaces the need for dimension tables
Correct answer: B. The fact table holds numeric measures (like sales amount) plus foreign keys linking to descriptive dimension tables.
In a Tableau or Power BI report, converting a measure from SUM to AVERAGE at a monthly grain but showing it at yearly grain can mislead because of what?
  • A. Data type mismatch
  • B. Aggregation of an already-aggregated average (average of averages) ✓
  • C. Missing primary key
  • D. Incorrect join type
Correct answer: B. Averaging monthly averages weights each month equally regardless of underlying volume, producing an incorrect yearly average.
When cleaning data, you find a numeric column stored as text with commas (e.g., "1,200"). In pandas, the safest fix is to:
  • A. Use astype(int) directly
  • B. Remove commas with str.replace then convert with pd.to_numeric ✓
  • C. Cast with astype(float) directly
  • D. Use pd.to_numeric without stripping the commas first
Correct answer: B. You must strip the thousands separators first, then coerce to numeric; astype(int) alone would raise on the commas.
You need the total sales per region but also want every row of the original orders table to still appear with its running region total. Which SQL construct is most appropriate?
  • A. A GROUP BY without a window
  • B. A window function SUM() OVER (PARTITION BY region) ✓
  • C. A HAVING clause
  • D. A self-join on region only
Correct answer: B. A window function computes the aggregate per partition while preserving every original row, unlike GROUP BY which collapses rows.
In a LEFT JOIN between orders (left) and returns (right), rows in orders with no matching return will have which values for the returns columns?
  • A. Zero
  • B. NULL ✓
  • C. The previous row's value
  • D. They are excluded
Correct answer: B. A LEFT JOIN keeps all left rows and fills unmatched right-side columns with NULL.
Which pandas method would you use to fill missing values in a DataFrame column with that column's mean?
  • A. df['col'].dropna()
  • B. df['col'].fillna(df['col'].mean()) ✓
  • C. df['col'].replace(0)
  • D. df['col'].interpolate('mode')
Correct answer: B. fillna() replaces NaN values, and passing the column mean imputes missing entries with the average.
When calculating month-over-month growth, which SQL window function retrieves the previous month's value in the same result set?
  • A. RANK()
  • B. LAG() ✓
  • C. ROW_NUMBER()
  • D. NTILE()
Correct answer: B. LAG() accesses a value from a prior row within the ordered partition, ideal for period-over-period comparisons.
A distribution has a mean of 50 and a median of 65. What does this most likely indicate?
  • A. The distribution is symmetric
  • B. The distribution is left-skewed (negatively skewed) ✓
  • C. The distribution is right-skewed (positively skewed)
  • D. There are no outliers
Correct answer: B. When the mean is pulled below the median, a long left tail exists, indicating negative (left) skew.
In a pivot table summarizing revenue by product and month, what is the correct role for 'month'?
  • A. A value/measure aggregated with SUM
  • B. A dimension placed on rows or columns ✓
  • C. A filter that removes products
  • D. A calculated field
Correct answer: B. Month is a categorical dimension used to segment the data, while revenue is the aggregated measure.
You run A/B test and get a p-value of 0.03 at a 0.05 significance level. What is the correct interpretation?
  • A. There is a 3% chance the result is due to the alternative hypothesis
  • B. Reject the null hypothesis; the result is statistically significant ✓
  • C. Accept the null hypothesis
  • D. The effect size is 3%
Correct answer: B. A p-value below the 0.05 threshold leads to rejecting the null hypothesis as statistically significant.
Which SQL query correctly returns customers who placed NO orders, given customers LEFT JOIN orders?
  • A. WHERE orders.id = 0
  • B. WHERE orders.id IS NULL ✓
  • C. WHERE orders.id != customers.id
  • D. HAVING COUNT(orders.id) > 0
Correct answer: B. After a LEFT JOIN, customers with no orders have NULL order columns, so filtering IS NULL isolates them.
In data cleaning, why is it problematic to simply drop all rows containing any missing value?
  • A. It always corrupts the primary key
  • B. It can introduce bias and lose substantial usable data ✓
  • C. SQL does not allow it
  • D. It changes column data types
Correct answer: B. Listwise deletion can bias results if missingness is not random and wastes otherwise valid data in other columns.
Which normalization technique rescales a numeric feature to a 0-to-1 range?
  • A. Z-score standardization
  • B. Min-max scaling ✓
  • C. Log transformation
  • D. One-hot encoding
Correct answer: B. Min-max scaling maps values to [0,1] using (x - min)/(max - min), unlike z-score which centers on mean/std.

Hard round 30 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.
A LEFT JOIN unexpectedly drops rows from the left table. The most common cause is:
  • A. Using SELECT * instead of naming columns
  • B. Placing a filter on the right table in the WHERE clause instead of the ON clause ✓
  • C. Missing an ORDER BY
  • D. The right table having a primary key
Correct answer: B. A WHERE condition on the right table's column filters out the NULL non-matches, effectively turning the LEFT JOIN into an INNER JOIN; the predicate belongs in ON.
You run an A/B test and get p = 0.03 at alpha = 0.05. Which interpretation is correct?
  • A. There is a 3% chance the null hypothesis is true
  • B. If the null were true, there is a 3% chance of data this extreme or more ✓
  • C. The effect is 3% in size
  • D. There is a 97% chance the alternative is true
Correct answer: B. A p-value is the probability of observing data at least as extreme as seen, assuming the null hypothesis is true.
Simpson's paradox occurs when:
  • A. A trend present in aggregated data reverses within subgroups ✓
  • B. Two variables are perfectly correlated
  • C. A sample is too small to be significant
  • D. Data contains duplicate rows
Correct answer: A. Simpson's paradox is when an association seen in combined data reverses or disappears once the data is split by a confounding subgroup.
In SQL, SELECT COUNT(*) vs COUNT(col) can differ because:
  • A. COUNT(*) is always slower
  • B. COUNT(col) ignores rows where col is NULL while COUNT(*) counts all rows ✓
  • C. COUNT(*) ignores NULLs
  • D. They are always identical
Correct answer: B. COUNT(*) counts every row, but COUNT(col) skips rows where that column is NULL, so results diverge when NULLs exist.
A running total window function returns wrong values on tied dates. The likely fix in the OVER clause is to change the frame specification because:
  • A. ORDER BY on a non-unique column with default RANGE frame includes all peer rows in the cumulative sum ✓
  • B. ROWS is never allowed with SUM
  • C. PARTITION BY is forbidden with ORDER BY
  • D. Window functions cannot compute running totals
Correct answer: A. With the default RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW, tied ORDER BY values are treated as peers and summed together; using ROWS frames each row individually.
You must deduplicate keeping the most recent record per customer in SQL. The most reliable single-query approach is:
  • A. SELECT DISTINCT customer_id
  • B. ROW_NUMBER() OVER (PARTITION BY customer_id ORDER BY updated_at DESC) then keep rn=1 ✓
  • C. GROUP BY customer_id with SELECT *
  • D. DELETE all duplicates blindly
Correct answer: B. ROW_NUMBER partitioned by customer and ordered by recency lets you filter rn = 1 to keep exactly the latest row per customer.
Regarding NULL handling, which expression correctly returns rows where email is NOT set?
  • A. WHERE email = NULL
  • B. WHERE email != NULL
  • C. WHERE email IS NULL ✓
  • D. WHERE email <> ''
Correct answer: C. NULL comparisons with = or != yield UNKNOWN, so you must use the IS NULL predicate to test for absence of a value.
When building a cohort retention analysis, why is anchoring each user to their signup-month cohort essential?
  • A. It reduces query cost
  • B. It allows measuring retention relative to a common starting point across users who joined at different times ✓
  • C. It removes the need for a date dimension
  • D. It converts the data to wide format automatically
Correct answer: B. Cohorting by signup period normalizes users' timelines so retention can be compared at equivalent tenure (month 1, month 2, etc.) despite different join dates.
A dashboard's total revenue differs from the source system because a fan-out join inflated rows. The root cause is typically:
  • A. Joining a fact table to a dimension at a one-to-many grain and then summing the measure ✓
  • B. Using COUNT instead of SUM
  • C. A missing WHERE clause on dates
  • D. Too few columns selected
Correct answer: A. Joining a measure at one grain to a table at a finer grain duplicates the measure across matches, so summing double-counts revenue.
You have imbalanced classes (2% churn). Which single metric is most misleading to report as model quality?
  • A. Precision
  • B. Recall
  • C. Overall accuracy ✓
  • D. F1 score
Correct answer: C. With 2% positives, a model predicting 'no churn' for everyone scores 98% accuracy while catching zero churners, making accuracy deceptive.
A query with COUNT(DISTINCT user_id) over a billion-row table is extremely slow. Which approximate technique is commonly used in analytics warehouses to speed this up with bounded error?
  • A. Bitmap bloom join
  • B. HyperLogLog (APPROX_COUNT_DISTINCT) ✓
  • C. Nested-loop dedup
  • D. Full table B-tree scan
Correct answer: B. HyperLogLog estimates cardinality with small memory and bounded error, powering APPROX_COUNT_DISTINCT functions.
You observe Simpson's Paradox: a treatment appears beneficial in every subgroup but harmful in the aggregate. What is the usual cause?
  • A. A random sampling error
  • B. A confounding variable unevenly distributed across subgroups ✓
  • C. Too small a sample size
  • D. A data type mismatch
Correct answer: B. Simpson's Paradox arises when a lurking/confounding variable's uneven distribution reverses the aggregate trend versus subgroups.
In SQL, what is the key semantic difference between COUNT(col) and COUNT(*) when col has NULLs, inside a GROUP BY with a LEFT JOIN producing unmatched rows?
  • A. They are always identical
  • B. COUNT(*) counts all rows including unmatched NULL rows; COUNT(col) skips NULLs, yielding a lower count ✓
  • C. COUNT(col) counts NULLs as zero
  • D. COUNT(*) ignores NULLs
Correct answer: B. COUNT(*) counts every row while COUNT(col) ignores NULLs, so unmatched LEFT JOIN rows inflate only COUNT(*).
When computing a 7-day rolling average that must reset at each store, which windowing specification is correct?
  • A. OVER (ORDER BY date ROWS BETWEEN 6 PRECEDING AND CURRENT ROW)
  • B. OVER (PARTITION BY store ORDER BY date ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) ✓
  • C. OVER (PARTITION BY date ORDER BY store)
  • D. OVER (ORDER BY store RANGE UNBOUNDED PRECEDING)
Correct answer: B. Partitioning by store isolates each store's series, and the 6-preceding-to-current frame yields a 7-row rolling window.
A correlation coefficient between ice cream sales and drowning deaths is 0.9. What is the most rigorous analyst conclusion?
  • A. Ice cream causes drownings
  • B. There is likely a confounder such as temperature/season driving both ✓
  • C. The correlation is a data error
  • D. One variable must be reverse-causing the other
Correct answer: B. High correlation without a causal mechanism typically signals a common confounder (hot weather increases both).
In a star schema, why are fact tables typically kept 'narrow and long' rather than storing descriptive attributes directly?
  • A. To enforce primary keys
  • B. To reduce storage redundancy and let dimensions be updated independently ✓
  • C. Because SQL cannot join wide tables
  • D. To avoid using surrogate keys
Correct answer: B. Keeping descriptive attributes in dimension tables avoids duplicating them across millions of fact rows and eases updates.
You need the median of a large column in standard SQL that lacks a MEDIAN function. Which approach is correct?
  • A. AVG(column)
  • B. PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY column) ✓
  • C. MAX(column)/2
  • D. COUNT(column)/2
Correct answer: B. PERCENTILE_CONT(0.5) computes the continuous 50th percentile, which is the median.
When a dashboard's daily active users metric suddenly drops 40% but revenue is flat, what is the FIRST thing a rigorous analyst should check?
  • A. Immediately alert executives to churn
  • B. Whether the tracking/logging pipeline or event definition changed (data quality) ✓
  • C. Rebuild the entire ETL
  • D. Change the chart type
Correct answer: B. A large metric shift inconsistent with correlated metrics usually signals an instrumentation or pipeline issue, checked before business conclusions.
In hypothesis testing, running 20 independent A/B comparisons each at alpha=0.05 inflates which error, and what corrects it?
  • A. Type II error; increase sample size
  • B. Family-wise Type I error; a Bonferroni or similar correction ✓
  • C. Sampling bias; stratification
  • D. Measurement error; log transform
Correct answer: B. Multiple comparisons inflate the family-wise false-positive (Type I) rate, mitigated by corrections like Bonferroni.
A cohort retention curve is flattening after week 4 rather than dropping to zero. What does this asymptote most meaningfully indicate?
  • A. The data is corrupted
  • B. A stable core of retained ('sticky') users representing product-market fit ✓
  • C. Seasonality
  • D. That the cohort was too small
Correct answer: B. A flattening retention curve indicates a durable base of loyal users who keep returning, a positive product-market-fit signal.

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: August 2026.