← All papers

Answer Key

Statistics, Probability & Power BI - Evaluation (Actual Paper, Set 2)

32 questions · 9 topics · correct answers with explanations

CodeWithMunnaX

⬇ Download PDF
Topic 1

Probability & Bayes' Theorem

3 Qs
Q20Single choice

A grocery app logs 400 baskets. Of these, 160 contain milk and 100 contain both milk and tea. For a shopper who already has milk in the basket, what is the probability that tea is also in the basket?

  1. A0.25, which is 100 out of all 400 baskets
  2. B0.625, which is 100 out of the 160 milk baskets✓ Correct
  3. C0.40, which is 160 out of all 400 baskets
  4. D0.375, which is the 60 milk-only baskets out of 160

Explanation

Conditional probability restricts attention to the baskets where the condition holds: P(tea | milk) = P(tea and milk) / P(milk) = (100/400) / (160/400) = 100/160 = 0.625. Dividing 100 by all 400 baskets gives the joint probability, 160/400 is just the probability of milk, and 60/160 = 0.375 is the share of milk baskets that have no tea.

Q25Single choice

A bank's model flags 12% of all loan applications as risky. Among applicants who eventually default, who make up 4% of all applicants, the model flags 75%. For an applicant who has just been flagged, what is the probability of eventually defaulting?

  1. A4%, the prior default rate before flagging
  2. B75%, the model's flag rate for defaulters
  3. C9%, from 0.75 multiplied by 0.12
  4. D25%, from 0.75 × 0.04 divided by 0.12✓ Correct

Explanation

Bayes' theorem gives the posterior P(default | flagged) = P(flagged | default) x P(default) / P(flagged) = 0.75 x 0.04 / 0.12 = 0.25. The 75% figure is the likelihood, which answers the reverse question; 4% is the prior before any evidence is seen; and 9% results from multiplying the likelihood by the evidence term instead of dividing.

Q29Single choice

A message filter uses the comparison form of Bayes' theorem to decide among three categories for an incoming message. For the observed words the prior and likelihood are: Promotional (prior 0.50, likelihood 0.02), Transactional (prior 0.30, likelihood 0.05) and Phishing (prior 0.20, likelihood 0.06). Which category has the highest posterior, and why can P(evidence) be skipped?

  1. APromotional; it has the highest prior, and the evidence term only rescales the likelihoods
  2. BPhishing; it has the highest likelihood, and the evidence term would cancel out all the priors
  3. CTransactional; the evidence term is the same for every category, so prior × likelihood decides✓ Correct
  4. DTransactional; the evidence term is largest for it, which scales the other products down

Explanation

When hypotheses are only being compared, the posterior is proportional to likelihood x prior because the denominator P(evidence) is constant across the comparison. The products are 0.50 x 0.02 = 0.010 for Promotional, 0.30 x 0.05 = 0.015 for Transactional and 0.20 x 0.06 = 0.012 for Phishing, so Transactional wins. The highest likelihood (Phishing) or the highest prior (Promotional) alone does not decide the result, and the evidence term does not differ between categories.

Topic 2

Descriptive Statistics & Z-scores

3 Qs
Q11Single choice

Five weekly sales figures have a sample mean of 40. Four of them are 38, 45, 41 and 36. What is the fifth figure, and what does this show about dividing by n - 1 when computing a sample variance?

  1. A40; the fixed mean pins it down, yet all five values vary freely so the divisor is 5
  2. B40; the fixed mean pins it down, so only four values vary and the divisor is 4✓ Correct
  3. CNot determinable; the fifth value is free to vary, so the divisor is 5
  4. DNot determinable; the fifth value is free to vary, so the divisor is 4

Explanation

Five values with a mean of 40 must total 200, and the known four total 160, so the fifth value is forced to be 40 (the deviations from the mean always sum to zero). Once the sample mean is computed from the data, only n - 1 = 4 observations can vary independently while the last is constrained, which is why the sample variance divides by the degrees of freedom n - 1 instead of n. Treating the fifth value as free contradicts the fixed mean, and keeping five free values would not justify an n - 1 divisor.

Q15Single choice

A credit model uses two features: age (mean 35 years, standard deviation 5) and monthly income (mean INR 80,000, standard deviation INR 20,000). An applicant is 45 years old and earns INR 100,000 a month. After both features are standardised, which statement is correct?

  1. AIncome is further from its mean, because its raw gap of INR 20,000 exceeds the age gap
  2. BAge is further from its mean (z = 2) than income is from its own (z = 1)✓ Correct
  3. CBoth sit at z = 1, because standardising maps every feature to the same value
  4. DThe two cannot be compared, since the units still differ after standardising

Explanation

The z-score z = (x - μ) / σ expresses each value in units of its own standard deviation: age gives (45 - 35) / 5 = 2 and income gives (100,000 - 80,000) / 20,000 = 1. So the applicant is more extreme on age even though the raw income gap looks far larger, which is exactly why standardising puts features with different scales on a common scale. Standardising does not force every value to the same z, and the common scale removes the unit problem.

Q26Single choice

A hiring portal reports that the mean salary offered to its freshers last quarter was INR 9.8 lakh, while the median salary was INR 6.4 lakh. What does this gap most plausibly indicate about the salary distribution?

  1. ALeft-skewed, with a few very low offers pulling the mean downward
  2. BRight-skewed, with a few very high offers pulling the mean upward✓ Correct
  3. CSymmetric, since the mean and the median both locate the centre
  4. DCategorical, so only the mode is a valid measure of the centre

Explanation

When the mean is larger than the median, a handful of very large values are dragging the average to the right of the typical value, which is the pattern of right-skewed data with a long tail towards the right. A left-skewed set would show the mean below the median, and a symmetric set would show the two close together. Salary is numeric, so the mean and median are both valid here and the mode is not the only usable measure.

Topic 3

Distributions & Sampling

6 Qs
Q9Multiple select

A forecasting team is mixing up discrete and continuous probability tools. Which of the following statements are correct?

Note: This is a Multiple Select Question (MSQ). The answer is marked incorrect if any correct option is missed or any incorrect option is selected.

  1. AA PDF value at a point equals the probability that the variable takes exactly that value
  2. BSumming a PMF over all outcomes gives 1, and integrating a PDF over its full range also gives 1✓ Correct
  3. CFor a continuous variable the probability of any exact single value is zero, so probabilities belong to ranges✓ Correct
  4. DA normal variable has its highest single-value probability at the mean, because the curve peaks there

Explanation

A continuous variable has infinitely many possible values, so the probability of one exact value is zero and probability is found as the area under the curve between two points. Total probability is 1 in both cases: a PMF sums to 1 over discrete outcomes and a PDF integrates to 1 over its range. A PDF value is a density, not a probability, and the peak of the normal curve at the mean is the highest density, not a non-zero single-value probability.

Q16Single choice

The delivery times of a fleet are roughly bell-shaped with a mean of 30 minutes and a standard deviation of 4 minutes. Using the 68-95-99.7 rule, about what share of deliveries finish between 26 and 38 minutes?

  1. AAbout 84%
  2. BAbout 68%
  3. CAbout 82%✓ Correct
  4. DAbout 95%

Explanation

26 minutes is one standard deviation below the mean and 38 minutes is two standard deviations above it. Because the distribution is symmetric, half of the 68% band (34%) lies between 26 and 30 and half of the 95% band (47.5%) lies between 30 and 38, giving 81.5%, which is about 82%. 68% would cover only 26 to 34 minutes, 95% would cover 22 to 38 minutes, and 84% is the share of deliveries above 26 minutes without any upper cut-off at 38.

Q19Single choice

A polling team's sample of 400 respondents gives a standard error of 2.0 points on average approval. The client wants the standard error cut to 1.0 point. Assuming the population standard deviation stays the same, what sample size is needed?

  1. A1,600 respondents; standard error falls with the square root of n✓ Correct
  2. B800 respondents; the standard error falls in direct proportion to n
  3. C1,200 respondents; each extra 400 respondents removes 0.5 points
  4. D3,200 respondents; the standard error falls with the cube root of n

Explanation

The standard error is σ/√n, so it shrinks with the square root of the sample size. Halving it from 2.0 to 1.0 requires √n to double, which means n must grow by a factor of four, from 400 to 1,600. Doubling to 800 would only reduce the standard error by a factor of about 1.41, and the other two options rely on relationships that the formula does not contain.

Q21Single choice

To judge nationwide interest in a new online course, a startup surveys only the students who happen to walk past its Bengaluru office on a Tuesday. Which description fits this sampling plan best?

  1. ASimple random sampling, since each student has an equal chance
  2. BStratified sampling, since students naturally form groups by city
  3. CSystematic sampling, since every kth passer-by would be selected
  4. DConvenience sampling, which is highly biased for this claim✓ Correct

Explanation

Picking whoever is easiest to reach is convenience sampling, and it is highly biased when the goal is to say something about students across the whole country because one location and one day cannot represent them. Stratified sampling needs groups that already exist in the population and a proportional draw from each. Systematic sampling needs a fixed rule such as every kth person. Simple random sampling needs every student in the population to have an equal chance of selection, which students in other cities do not.

Q23Single choice

A team draws 500 independent samples of 64 orders each from a population of order values that is strongly right-skewed with a standard deviation of INR 40. It then plots a histogram of the 500 sample means. Which description fits that histogram best?

  1. ARight-skewed like the population itself, with spread near the population value of 40
  2. BRoughly bell-shaped, centred near the population mean, with spread near 40/√64 = 5✓ Correct
  3. CRoughly bell-shaped, but with spread near the population standard deviation of 40
  4. DRight-skewed like the population, but with spread shrunk to about 40/√64 = 5

Explanation

By the central limit theorem the distribution of sample means approaches a normal distribution regardless of the shape of the original population, so the histogram of means is roughly bell-shaped and centred near the population mean. Its spread is the standard error σ/√n = 40/√64 = 5, far narrower than the population's 40. The other options either keep the population's skew or keep its wider spread, and averaging changes both.

Q24Single choice

A risk team needs a probability model for each of the situations below. In which situation can the binomial formula be applied directly?

  1. ANumber of defaulters among 15 loans, each independently defaulting with probability 0.04✓ Correct
  2. BNumber of calls reaching a help desk in an hour, when only the long-run hourly average is known
  3. CDelivery time of one parcel, which can take any value within a continuous range
  4. DNumber of buyers among 10 visitors, where every purchase raises the next visitor's chance

Explanation

The binomial distribution needs binary outcomes, a fixed number of trials, a constant success probability and independent trials; 15 loans with the same 4% default probability and independent behaviour meet all four. A count of calls known only through an average is the situation for the Poisson distribution, a delivery time is a continuous variable that needs a density over ranges, and visitors whose chances change after each purchase break the independence and constant-probability requirements.

Topic 4

Hypothesis Testing

5 Qs
Q8Multiple select

A school tests the claim that average marks improved this year, with H₁ stating that marks increased. The analysis returns a p-value of 0.03. Which conclusions follow?

Note: This is a Multiple Select Question (MSQ). The answer is marked incorrect if any correct option is missed or any incorrect option is selected.

  1. AH₁ has been proven true beyond any doubt
  2. BH₀ is rejected at a significance level of 0.01
  3. CH₀ is rejected at a significance level of 0.05✓ Correct
  4. DH₀ is also rejected at a significance level of 0.10✓ Correct

Explanation

The decision rule rejects H₀ when the p-value is smaller than the level of significance. Since 0.03 is below both 0.05 and 0.10, H₀ is rejected at those levels, but 0.03 is not below 0.01, so H₀ is not rejected at that stricter level. A low p-value is strong evidence against H₀; it does not prove that H₁ is true.

Q10Multiple select

A data team must pick a test for each study below. Which studies call for a dependent (paired) t-test?

Note: This is a Multiple Select Question (MSQ). The answer is marked incorrect if any correct option is missed or any incorrect option is selected.

  1. ABattery life of 16 phones of one model against 16 phones of a newer model
  2. BHours of sleep for the same 30 patients before and after a medication✓ Correct
  3. COffline and online prices recorded for the very same 25 books✓ Correct
  4. DAverage hourly output across three separate manufacturing plants

Explanation

A paired test applies when the same group is measured twice or when matched items are compared, which covers the same patients before and after medication and the same books priced offline and online. Two different sets of phones are independent samples and need a two-sample independent t-test, and three plants involve more than two groups, which calls for ANOVA.

Q12Single choice

A pharma lab tests whether a new tablet cures a viral infection, with H₀ stating that the tablet does not cure it. The sample leads the lab to reject H₀, yet in reality the tablet has no curing effect. What has happened, and which quantity sets how often this mistake occurs?

  1. AA Type II error, whose probability equals the significance level α
  2. BA Type I error, whose probability equals β, the complement of power
  3. CA Type I error, whose probability equals the significance level α✓ Correct
  4. DA Type II error, whose probability equals β, the complement of power

Explanation

Rejecting a null hypothesis that is actually true is a Type I error, the false-positive case of declaring an innocent person guilty, and its probability is the level of significance α. A Type II error is the opposite mistake of failing to reject a false null hypothesis, and its probability is β, where power is 1 - β.

Q27Single choice

An analyst at a quick-commerce startup wants to know whether the share of returned orders depends on the city in which the order was placed. City and return status (returned or not returned) are both categorical. Which test fits this question?

  1. APaired t-test, since the same orders are measured twice
  2. BOne-way ANOVA, since there are more than two cities
  3. CChi-square test, since both variables are categorical✓ Correct
  4. DOne-sample t-test, since the return rate is one number

Explanation

A chi-square test checks for an association between two categorical variables, which is exactly the question of whether return status is independent of city. One-way ANOVA compares the means of a numeric variable across groups, a paired t-test needs the same subjects measured under two conditions, and a one-sample t-test compares one sample mean with a benchmark value; none of these tests whether two categorical variables are related.

Q28Single choice

An analyst wants to know whether average delivery time differs across five cities and plans to run a separate two-sample t-test for every pair of cities. How many tests would that be, and what should be used instead?

  1. A10 tests; a chi-square test across all five cities instead
  2. B5 tests; one one-way ANOVA across all five cities instead
  3. C10 tests; one one-way ANOVA across all five cities instead✓ Correct
  4. D20 tests; one one-way ANOVA across all five cities instead

Explanation

Five cities form 5 x 4 / 2 = 10 distinct pairs, so pairwise testing would need ten t-tests, and running many tests inflates the chance of a false positive. A single one-way ANOVA compares the means of more than two groups at once and avoids this multiple comparison problem. Counting 5 or 20 tests miscounts the pairs, and chi-square is a test for two categorical variables, not for comparing mean delivery times.

Topic 5

Model Evaluation Metrics

1 Qs
Q30Single choice

A fraud model screens 1,000 transactions, of which 20 are fraudulent. It flags 40 transactions, and 16 of those are genuinely fraudulent. A teammate says the accuracy of 97.2% proves the model is excellent. Which assessment is most defensible?

  1. AAccuracy misleads: flagging nothing would score 98%, while precision is 40% and recall 80%✓ Correct
  2. BAccuracy is reliable here because the dataset is large, and a precision of 40% is acceptable
  3. CThe model is poor because its recall is only 40%, even though its precision is 80%
  4. DAccuracy misleads because the classes are balanced, so precision and recall add no information

Explanation

The confusion matrix is TP = 16, FP = 24, FN = 4 and TN = 956, so accuracy is 972/1000 = 97.2%, precision is 16/40 = 40% and recall is 16/20 = 80%. With only 2% fraud, a model that never flags anything would already reach 98% accuracy, so accuracy is misleading on imbalanced data and precision and recall tell the real story: the model catches most fraud but most of its flags are false alarms. Reading recall as 40% and precision as 80% swaps the two metrics, trusting accuracy because the dataset is large ignores the imbalance, and calling the classes balanced is wrong since only 2% of transactions are fraudulent.

Topic 6

Power BI & BI Tools

7 Qs
Q1Multiple select

A BI developer is building a sales dashboard on a shared data source. Which statements are correct?

Note: This is a Multiple Select Question (MSQ). The answer is marked incorrect if any correct option is missed or any incorrect option is selected.

  1. ARenaming Cust_ID to Customer ID once in the semantic model carries to every chart built on it✓ Correct
  2. BA worksheet is a collection of dashboards combined into one interface
  3. CAn extract connection sends a fresh query to the source database each time a dashboard is opened
  4. DA postal code looks numeric but is used to slice data, so it behaves as a dimension✓ Correct

Explanation

Fields that look numeric, such as postal codes and order IDs, are dimensions when they are used to slice or group the data, and the semantic model applies cosmetic transformations such as renaming fields once so that they flow to all downstream visualizations. A worksheet is a single chart and a dashboard combines several worksheets, so calling a worksheet a collection of dashboards reverses the relationship. A fresh query on every view describes a live connection, whereas an extract serves stored snapshots refreshed on a schedule.

Q2Multiple select

Priya is preparing an order file in Power BI before building the dashboard. Which of the following tasks belong in Power Query, rather than in a DAX calculation after loading?

Note: This is a Multiple Select Question (MSQ). The answer is marked incorrect if any correct option is missed or any incorrect option is selected.

  1. AReplacing "US" with "United States" for consistent country names✓ Correct
  2. BCreating a Total Units Sold measure by summing one numeric column
  3. CPromoting the first row so that it becomes the column headers✓ Correct
  4. DCounting unique customers with a distinct-count measure over a column

Explanation

Power Query cleans, transforms and structures data before the dashboard is created, and promoting the first row to headers and find-and-replace on values are both of that kind. Summing a column into a measure and counting distinct customers are calculations done with DAX after the data is loaded.

Q4Multiple select

A company is shortlisting desktop-authored BI tools such as Tableau and Power BI. Which of the following are core components of the architecture of such tools?

Note: This is a Multiple Select Question (MSQ). The answer is marked incorrect if any correct option is missed or any incorrect option is selected.

  1. AA public viewer link that stakeholders open to interact with dashboards✓ Correct
  2. BServer or cloud infrastructure that manages connections and refreshes✓ Correct
  3. CA desktop authoring app where analysts build charts and dashboards✓ Correct
  4. DA notebook kernel that re-runs every chart for each person who opens it

Explanation

Desktop-authored BI tools such as Tableau and Power BI have a desktop authoring app for building charts and dashboards, server or cloud infrastructure that manages data connections and automatic updates in the background, and a public viewer through which stakeholders explore dashboards without technical knowledge. Re-running a notebook for every viewer is the manual Python approach that BI tools replace, not one of their components.

Q7Multiple select

In a Power BI sales model, a calculated column Profit = Quantity × Unit Price - Discount - Shipping Cost is added to the sales table. Total Profit is a measure that sums the Profit column, Total Sales sums a Sales column, and Profit Margin Percentage is Total Profit divided by Total Sales. The table holds two orders.

OrderQuantityUnit Price (INR)Discount (INR)Shipping Cost (INR)Sales (INR)
O145004001002,000
O2230015060600

Which statements are correct?

Note: This is a Multiple Select Question (MSQ). The answer is marked incorrect if any correct option is missed or any incorrect option is selected.

  1. AProfit Margin Percentage over both orders shows 70%, the average of the two order margins
  2. BTotal Profit over both orders shows INR 1,890, the sum of the two Profit values✓ Correct
  3. CThe Profit column evaluates row by row, giving INR 1,500 for O1 and INR 390 for O2✓ Correct
  4. DProfit Margin Percentage over both orders shows about 72.7%, total profit over total sales✓ Correct

Explanation

A calculated column is computed per row: O1 gives 4 x 500 - 400 - 100 = 1,500 and O2 gives 2 x 300 - 150 - 60 = 390. Total Profit sums them to 1,890, and the margin measure divides total profit by total sales: 1,890 / 2,600 is about 72.7%. Averaging the two order margins (75% and 65%) to get 70% is a different calculation, because the measure aggregates profit and sales first and divides afterwards.

Q14Single choice

In a BI tool, an analyst drags fields onto a sales chart. Which of the following fields is a measure rather than a dimension?

  1. AProfit, summed across the orders in a chart✓ Correct
  2. BPostal code, used to slice orders by area
  3. CRegion name, used as the chart's column header
  4. DOrder ID, used to label each individual row

Explanation

Measures are the numeric quantities that get aggregated with operations such as sum or average and appear as the values on an axis, and profit is exactly that. Dimensions slice and organise the data into chart headers, axis labels and groups; region, postal code and order ID all play that role, even though postal code and order ID look numeric.

Q17Single choice

A cookie shop's CookieTypes table has three rows: Choco (100 units sold, revenue INR 20 per cookie, cost INR 12 per cookie), Oatmeal (50 units, INR 15, INR 9) and Almond (40 units, INR 25, INR 10). The measure below is placed on a card visual.

Total Profit = SUMX(CookieTypes, [Unit_Sold] * ([Revenue_Per_Cookie] - [Cost_Per_Cookie]))

What value does the card show?

  1. AINR 1,700✓ Correct
  2. BINR 1,837
  3. CINR 2,050
  4. DINR 3,750

Explanation

SUMX works row by row and then aggregates: Choco gives 100 x 8 = 800, Oatmeal gives 50 x 6 = 300 and Almond gives 40 x 15 = 600, so the total is INR 1,700. INR 1,837 comes from multiplying total units by an averaged margin, INR 2,050 is only the total cost, and INR 3,750 is only the total revenue.

Q18Single choice

A retail chain's CFO opens a revenue dashboard once each morning, and the data warehouse behind it holds billions of rows shared by many teams. Separately, a control-room wall must show payment-gateway failures as they happen. Which connection plan fits both needs?

  1. ALive connection for the CFO view; extract with a scheduled refresh for the failure wall
  2. BLive connection for both views, so that no viewer ever sees data that is out of date
  3. CExtract for both views, refreshed once a day, to protect the shared warehouse
  4. DExtract with scheduled refresh for the CFO view; live only for the failure wall✓ Correct

Explanation

Extract is the sensible default: a once-a-day revenue view tolerates a scheduled lag, renders fast from stored snapshots and spares the shared warehouse from a query on every view. A live connection is justified only where real-time data is mandatory, which is the failure wall. Making both live hammers the warehouse and raises cost, making both extracts leaves the wall stale, and reversing the roles puts the real-time need on the lagging extract.

Topic 7

Data Visualisation & Storytelling

2 Qs
Q3Multiple select

A designer is simplifying a cluttered chart so that more of the ink carries actual data. Which of the following changes are consistent with removing clutter?

Note: This is a Multiple Select Question (MSQ). The answer is marked incorrect if any correct option is missed or any incorrect option is selected.

  1. AKeep any gridlines light gray and only where reading values needs them✓ Correct
  2. BAdd a 3D effect so that the bars stand out from the background
  3. CLabel the lines directly on the chart instead of adding a legend✓ Correct
  4. DWrap the plot area in a heavy border to frame the message

Explanation

Direct labelling removes the legend, which forces readers to juggle between legend and graph, and light gray gridlines used sparingly keep only the ink that helps read specific values. 3D effects are hard to interpret on a 2D surface and a heavy border is unnecessary framing, so both add decoration instead of data.

Q22Single choice

A dashboard shows profit gains in green and losses in red, with no other cue. Roughly 8% of men cannot tell the two reliably apart. Which change keeps the meaning readable without relying on colour alone?

  1. AMove the legend to the top-left corner of the chart
  2. BUse a rainbow palette with a different hue per series
  3. CMake the greens and reds more strongly saturated
  4. DAdd plus and minus signs next to the values✓ Correct

Explanation

Meaning should never be carried by colour alone, so adding symbols such as plus and minus signs (or patterns and different line styles) lets every viewer read the gain or loss. A rainbow palette lacks contrast and hierarchy, a stronger red-green pair is still a red-green pair, and relocating the legend does nothing for the colour-only encoding.

Topic 8

Seaborn & Plotly

3 Qs
Q5Multiple select

A dataset has five numerical columns and a categorical column, region, with four values. Which statements about choosing a seaborn visual for it are correct?

Note: This is a Multiple Select Question (MSQ). The answer is marked incorrect if any correct option is missed or any incorrect option is selected.

  1. AA facet grid suits discovering which numeric columns correlate, because it plots every possible pair on its own
  2. BA facet grid on region suits comparing one chosen relationship across the four regions, with the split variable picked manually✓ Correct
  3. CA pair plot suits first-look exploration because it plots every numeric column against every other automatically✓ Correct
  4. DA pair plot of the five numeric columns produces ten panels, because each unique pair appears once

Explanation

A pair plot plots every numerical variable against every other one without the user choosing, which makes it the quick tool for exploratory analysis, whereas a facet grid needs the analyst to choose which variable to split on and so serves a specific, predetermined comparison such as one relationship across four regions. A pair plot of five numeric columns is a 5 x 5 grid of 25 panels (the diagonal shows distributions and the mirror panels repeat each other), not ten, and the automatic every-pair behaviour belongs to the pair plot, not the facet grid.

Q6Multiple select

A data scientist writes the following call to share an interactive view with stakeholders.

fig = px.scatter(df, x="usage_a", y="usage_b", color="plant_type",
                 size="usage_c", hover_name="customer",
                 animation_frame="month", animation_group="customer")

Which statements about this call are correct?

Note: This is a Multiple Select Question (MSQ). The answer is marked incorrect if any correct option is missed or any incorrect option is selected.

  1. AThe size argument scales each marker by the numerical column usage_c✓ Correct
  2. BThe hover_name argument colour-codes every point by the customer name
  3. CThe points are colour-coded by the values in the plant_type column✓ Correct
  4. Danimation_group keeps each customer's point the same object across the frames✓ Correct

Explanation

In Plotly Express, color colour-codes points by a categorical column, size sets the marker size from a numerical variable (here usage_c), and animation_group keeps each object's identity across animation frames while animation_frame animates the figure over the values of month. hover_name only controls the name displayed when a user hovers over a point; it does not colour anything.

Q13Single choice

A data scientist runs the call below on a DataFrame that has four numeric columns plus two categorical columns, region and plant_type.

sns.pairplot(df, hue="plant_type", corner=True)

How many subplot panels does the resulting figure contain?

  1. A6 panels: only the unique off-diagonal scatters remain
  2. B16 panels: corner=True only changes the colours of the grid
  3. C36 panels: all six columns are plotted against each other
  4. D10 panels: 4 diagonal plots plus 6 lower-triangle scatters✓ Correct

Explanation

A pair plot plots every numerical variable against every other numerical variable, so the four numeric columns give a 4 x 4 grid of 16 panels and the categorical columns only supply the colour grouping through hue. The diagonal shows each variable's distribution rather than a scatter plot, and corner=True removes the redundant mirror panels above it. That leaves the 4 diagonal panels plus 6 unique lower-triangle scatters, which is 10 panels.

Topic 9

Case Studies (Subjective)

2 Qs
Q31Subjective

Problem Statement

Roadrunner Logistics runs two hubs, Pune and Chennai, and delivers with vans and bikes. The operations head wants to understand how distance, load and delivery time interact, whether the distance-to-time relationship differs by hub, and how to present the findings to the CEO and to three managers who will watch a daily dashboard.

Dataset

Twelve delivered routes:

hubvehicledistance_kmload_kgdelivery_min
PuneVan4.212022
PuneVan8.518031
PuneVan12.015038
PuneBike2.11512
PuneBike5.02019
PuneBike7.42526
ChennaiVan3.811025
ChennaiVan9.120036
ChennaiVan14.516047
ChennaiBike1.91011
ChennaiBike4.61817
ChennaiBike6.82223

Ready-to-run initializer (identical to the table above):

import pandas as pd
import seaborn as sns

df = pd.DataFrame({
    "hub": ["Pune"] * 6 + ["Chennai"] * 6,
    "vehicle": ["Van", "Van", "Van", "Bike", "Bike", "Bike"] * 2,
    "distance_km": [4.2, 8.5, 12.0, 2.1, 5.0, 7.4, 3.8, 9.1, 14.5, 1.9, 4.6, 6.8],
    "load_kg": [120, 180, 150, 15, 20, 25, 110, 200, 160, 10, 18, 22],
    "delivery_min": [22, 31, 38, 12, 19, 26, 25, 36, 47, 11, 17, 23],
})

Tasks

  1. Pair plot. Write seaborn code that plots every numeric column of df against every other, colouring the points by vehicle and removing the redundant mirror panels. State how many panels the figure contains and what the diagonal panels show.
  2. Facet grid with styling. Write seaborn code that draws delivery_min against distance_km as a scatter, with one column of panels per hub and points coloured by vehicle. Then apply a clean background style, a presentation-sized font context and removal of the plot borders.
  3. Choosing the visual. The operations head asks whether the distance-to-time relationship differs between the two hubs. Explain why a facet grid suits this question better than a pair plot, when the pair plot is the better tool, and one trade-off of the facet grid.
  4. CEO view. For a CEO-facing version of the Task 2 chart, write one quantifiable sentence the chart should deliver using numbers from the dataset, a headline-style title, what you would highlight in an accent colour and what you would make gray, two clutter elements you would remove, and one change that keeps the chart readable for colour-blind viewers.
  5. Dashboard design. The three managers will watch the same view in a BI tool every morning. Choose between a live connection and an extract and justify the choice using refresh needs and database load. Classify hub, vehicle and delivery_min as dimensions or measures and name an aggregation for the measure. Say where renaming delivery_min to "Delivery Time (min)" should be done and why it needs to be done only once.

Submission Format

Paste your code for Tasks 1 and 2 and write Tasks 3 to 5 as structured text, all in the input box, clearly labelled Task 1 to Task 5.

Note: You may use any IDE (online: Google Colab, Jupyter Notebook; offline: VS Code, PyCharm, or similar) to write, run, and test your code. You must disable all AI-based extensions (GitHub Copilot, Tabnine, Codeium, etc.) before starting. AI tools of any kind are not permitted and will lead to disqualification. Submit your complete code as a copy-pasted snippet in the input box — do not submit a URL, notebook link, GitHub repository, or Google Drive file.

Model answer

Question Explanation

This question tests whether you can use seaborn's pair plot and facet grid correctly, pick the right multi-dimension visual for a question, apply the design principles that make a chart land with a CEO, and make sound BI-tool decisions about connection type and the semantic model.

Short Explanation

Use sns.pairplot(df, hue="vehicle", corner=True) for 6 panels, sns.relplot with col="hub" and hue="vehicle" for the hub comparison, style it with sns.set_style, sns.set_context and sns.despine, pick the facet grid for a specific comparison, simplify the CEO chart around one quantified message, and use an extract with a semantic-model rename for the dashboard.

Long Explanation

Task 1: a pair plot plots every numerical variable against every other, so the three numeric columns give a 3 x 3 grid; hue colours by vehicle, and corner=True removes the mirror panels above the diagonal, leaving 3 diagonal distribution panels and 3 lower-triangle scatters, 6 panels in total. Task 2: sns.relplot handles scatter plots with a facet split: col="hub" creates one column of panels per hub and hue="vehicle" adds colour. sns.set_style sets the background (for example whitegrid), sns.set_context scales fonts for a presentation (talk) and sns.despine removes borders. Task 3: the question is about one chosen relationship across a category, which is what a facet grid is built for, since the analyst picks the split variable; a pair plot is automatic and best for exploration when no relationship has been chosen yet; the trade-off is that many categories would create too many panels. Task 4: a CEO needs the conclusion and the key number, so the chart should make exactly one point, for example that bikes finish every route of up to 7.4 km within 26 minutes while vans on routes of 12 km or more need 38 to 47 minutes. The title is a headline stating that conclusion, the vans' long-distance points get an accent colour while everything else is gray, clutter such as borders, 3D effects and heavy gridlines is removed (and the legend replaced by direct labels), and plus/minus symbols, patterns or different marker shapes keep it readable for colour-blind viewers. Task 5: a morning view tolerates a scheduled lag, and an extract renders fast from stored snapshots while sparing the database from a live query on each view, so extract is the right default. hub and vehicle are dimensions that slice the data; delivery_min is a measure aggregated with an average. The rename belongs in the semantic model, which is built once and applies automatically to every downstream visualization.

Model Solution

import pandas as pd
import seaborn as sns

df = pd.DataFrame({
    "hub": ["Pune"] * 6 + ["Chennai"] * 6,
    "vehicle": ["Van", "Van", "Van", "Bike", "Bike", "Bike"] * 2,
    "distance_km": [4.2, 8.5, 12.0, 2.1, 5.0, 7.4, 3.8, 9.1, 14.5, 1.9, 4.6, 6.8],
    "load_kg": [120, 180, 150, 15, 20, 25, 110, 200, 160, 10, 18, 22],
    "delivery_min": [22, 31, 38, 12, 19, 26, 25, 36, 47, 11, 17, 23],
})

# Task 1: pair plot, coloured by vehicle, mirror panels removed
sns.pairplot(df, hue="vehicle", corner=True)

# Task 2: facet grid with styling
sns.set_style("whitegrid")
sns.set_context("talk")
sns.relplot(data=df, x="distance_km", y="delivery_min", col="hub", hue="vehicle")
sns.despine()

Task 1 answer. 6 panels: 3 diagonal panels showing the distribution of each numeric variable plus 3 lower-triangle scatters.

Task 3. A facet grid compares one chosen relationship (distance vs delivery time) across a category (hub), with the split variable chosen manually. A pair plot is automatic and best for exploration. Trade-off: too many panels with many categories.

Task 4. Message: bikes finish every route up to 7.4 km within 26 minutes, while vans on routes of 12 km or more need 38 to 47 minutes. Headline title stating that conclusion; van long-route points in an accent colour with everything else in gray; remove borders and 3D effects and label directly instead of using a legend; add marker shapes or symbols so colour is not the only cue.

Task 5. Extract (scheduled refresh is enough; lighter load on the database). hub and vehicle are dimensions; delivery_min is a measure, aggregated as an average. Rename in the semantic model, which is built once and applies to every downstream visualization.

Q32Subjective

Scenario

SwiftBite, a quick-delivery startup, advertises "groceries in 15 minutes". Its analyst audits the claim with three pieces of evidence. Use a significance level of α = 0.05 throughout.

Data

Evidence 1: delivery times. A random sample of 16 orders has a mean delivery time of x̄ = 17.2 minutes and a sample standard deviation of s = 4.4 minutes. The critical t-value at 15 degrees of freedom and α = 0.05 is ±2.131 for a two-tailed test and 1.753 for a one-tailed test.

Evidence 2: rider training. The same six riders were timed on a comparable route before and after a training programme.

RiderBefore (min)After (min)
R11812
R21614
R32017
R41514
R51915
R61412

For a one-tailed test at α = 0.05 with 5 degrees of freedom, the critical t-value is 2.015.

Evidence 3: late-delivery classifier. Of 200 orders, 20 were actually late. A model flagged 30 orders as late, and 15 of those flagged orders were actually late.

Tasks

  1. Two-tailed test. The company claims the true mean delivery time is 15 minutes. State H₀ and H₁, give the degrees of freedom, compute the standard error and the t-statistic, compare it with the critical value, and state your decision. Say what the decision does and does not tell the company.
  2. Directional re-test. The operations head now says the real worry is deliveries taking longer than 15 minutes. Restate H₀ and H₁ for this directional claim, decide using the one-tailed critical value, and explain why the decision differs from Task 1 on identical data by describing where the rejection region sits in each design. State the probability of a Type I error under each design, and say at which step of the testing process the direction must be fixed.
  3. Rider training. Name the appropriate test for Evidence 2 and justify why an independent two-sample test is unsuitable. State H₀ and H₁ for the claim that training reduces delivery time, compute the six differences (before minus after) with their mean and sample standard deviation, treat the differences as a single sample tested against 0 using the one-sample t formula, compute t, compare it with 2.015, and conclude in business terms.
  4. Classifier check. Using Evidence 3, build the confusion matrix and compute accuracy, precision and recall. Show why accuracy alone is misleading here, and map false positives and false negatives to Type I and Type II errors, taking "the order is on time" as H₀.

Submission Format

Write a structured response in the input box, clearly labelled Task 1 to Task 4, with all working shown.

Note: Write your answer in clear, concise English. Bullet points and structured sections are encouraged. Do not paste external links or screenshots — write the full response in the input box provided. AI tools of any kind are not permitted and will lead to disqualification.

Model answer

Question Explanation

This question tests whether you can run and interpret a one-sample t-test, see how the choice of one-tailed or two-tailed framing changes a borderline decision, recognise when a paired test is required, and read a confusion matrix on imbalanced data.

Short Explanation

Task 1 gives t = 2.0 against ±2.131 so H₀ is not rejected; Task 2 gives 2.0 against 1.753 so H₀ is rejected; Task 3 is a paired test with t of about 4.11 against 2.015 so training works; Task 4 gives accuracy 90%, precision 50% and recall 75%, with accuracy no better than a model that flags nothing.

Long Explanation

Task 1: H₀: μ = 15 and H₁: μ ≠ 15, with df = 16 - 1 = 15. The standard error is 4.4/√16 = 1.1 and t = (17.2 - 15)/1.1 = 2.0. Because |2.0| is smaller than 2.131, the statistic is inside the acceptance region and H₀ is not rejected; this means the sample does not give strong enough evidence against the 15-minute claim, not that the claim is proven. Task 2: with H₁: μ > 15 the whole 5% rejection region sits in the upper tail, so the cut-off is 1.753 and t = 2.0 exceeds it, so H₀ is rejected. In the two-tailed design the 5% is split 2.5% per tail, which moves each cut-off out to 2.131, and the same data now falls short. The Type I error probability is α = 5% in both designs, and because hypotheses are framed first in the testing process, the direction has to be fixed before the test statistic is calculated. Task 3: the same riders are measured twice, so the samples are dependent and a paired t-test is used; an independent test would ignore that each pair belongs to one rider. With H₀: no reduction and H₁: training reduces time, the differences (before minus after) are 6, 2, 3, 1, 4 and 2, with mean 3.0. The squared deviations from 3.0 are 9, 1, 0, 4, 1 and 1, which sum to 16, so the sample variance is 16/5 = 3.2 and s is about 1.79. Then t = 3.0/(1.79/√6) is about 4.11, which exceeds 2.015, so H₀ is rejected: the training is linked to significantly shorter delivery times. Task 4: TP = 15, FP = 30 - 15 = 15, FN = 20 - 15 = 5 and TN = 200 - 15 - 15 - 5 = 165. Accuracy = (15 + 165)/200 = 90%, precision = 15/30 = 50% and recall = 15/20 = 75%. A model flagging nothing would be right on all 180 on-time orders and also score 90%, so accuracy hides the weak precision. With H₀ as the order is on time, a false positive (flagging an on-time order) is a Type I error and a false negative (missing a late order) is a Type II error.

Model Solution

Task 1. H₀: μ = 15 min; H₁: μ ≠ 15 min. df = 15. SE = 4.4/√16 = 1.1. t = (17.2 - 15)/1.1 = 2.0. Since |2.0| < 2.131, fail to reject H₀ at 5%. The sample does not give enough evidence against the 15-minute promise, but this does not prove the true mean is exactly 15 minutes.

Task 2. H₁: μ > 15 min (H₀: μ = 15 min). The one-tailed critical value is 1.753 and t = 2.0 > 1.753, so reject H₀. The two-tailed test splits the 5% into 2.5% in each tail, pushing the cut-off to 2.131; the one-tailed test puts all 5% in the upper tail, so a smaller cut-off applies. Type I error probability is 5% in both designs. The hypotheses, including the direction, are framed first, before the test statistic is computed.

Task 3. Dependent (paired) t-test, because the same riders are measured twice; an independent test ignores the pairing. H₀: no reduction; H₁: training reduces time. Differences (before - after): 6, 2, 3, 1, 4, 2; mean = 3.0; s ≈ 1.79. t = 3.0/(1.79/√6) ≈ 4.11 > 2.015, so reject H₀: training is associated with significantly shorter delivery times.

Task 4. TP = 15, FP = 15, FN = 5, TN = 165. Accuracy = 90%, precision = 50%, recall = 75%. A model that flags nothing also scores 90% accuracy, so accuracy is misleading on this imbalanced data. False positive = Type I error; false negative = Type II error.