Exploratory Data Analysis (EDA) MCQs for the NSCT
Exploratory data analysis (EDA) is the step where you summarise and plot a dataset to understand its centre, spread, shape, relationships and problems before building any model. It is the fifth of the 17 topics in the AI / Machine Learning and Data Analytics area, which carries 10% of the NSCT according to HEC's Areas of Competencies.
Questions here are mostly small calculations (mean, median, standard deviation, z-score, correlation) and interpretation: what a skewed histogram or a correlation of 0.9 does and does not tell you. The probability and statistics in Mathematical Foundations are the groundwork.
Summary statistics
Summary statistics describe a variable with a few numbers. Take 4, 8, 15, 16, 23, 42:
| Statistic | What it measures | Value here |
|---|---|---|
| Mean | Centre, using every value | 108 / 6 = 18 |
| Median | Middle of the sorted data | (15 + 16) / 2 = 15.5 |
| Mode | Most frequent value | None (all unique) |
| Range | max - min | 38 |
| Standard deviation | Typical distance from the mean | 12.32 (population), 13.49 (sample) |
Sample variance divides by n - 1 (Bessel's correction) and population variance by n. Libraries differ: pandas .std() uses n - 1 by default, while NumPy np.std() uses n.
The IQR (Q3 - Q1) gives the spread of the middle 50%. Quartile conventions differ between textbooks and software, so exam questions usually give Q1 and Q3 or use data where every method agrees.
Exam angle: the median and IQR are robust to outliers; the mean, standard deviation and range are not. Use the mode for nominal data.
Distributions
A distribution shows how often each value occurs. The key EDA plots:
- Histogram: the shape of one numeric variable.
- Box plot: median, quartiles, whiskers and plotted outliers. Good for comparing groups.
- Bar chart: counts of a categorical variable, including the target classes.
Shapes to recognise:
| Shape | Typical clue | Example |
|---|---|---|
| Symmetric (normal) | mean ≈ median | Heights |
| Right (positive) skew | mean > median, long right tail | Income, house prices |
| Left (negative) skew | mean < median | Scores on a very easy exam |
| Bimodal | Two peaks | A mix of two customer groups |
For a normal distribution the empirical rule holds: about 68%, 95% and 99.7% of values lie within 1, 2 and 3 standard deviations. Kurtosis describes tail weight; the normal value is 3, or 0 as "excess kurtosis", and libraries report one or the other.
Exam angle: the mean-versus-median rule for skew is a rule of thumb that holds for typical skewed data, which is what exam questions assume.
Correlation
Pearson's r = covariance / (sd of x x sd of y). It lies between -1 and +1 and measures only linear association. For x = 2, 4, 6, 8 and y = 3, 7, 5, 9, r = 0.8.
Spearman's rho is Pearson's r computed on ranks, so it measures any monotonic trend and is more robust to outliers. A correlation heatmap shows all pairs at once and flags redundant features (multicollinearity).
Exam angle: r is unchanged when you rescale with a positive factor or add a constant, such as converting Celsius to Fahrenheit. A negative factor flips its sign.
Common traps
- Reading correlation as causation. A confounder (age, weather) can drive both variables.
- Concluding "no relationship" from r = 0. A U-shaped pattern such as y = x² can give r = 0.
- Trusting summaries without plots. Anscombe's quartet has four datasets with the same statistics and very different shapes.
- Mixing up sample (n - 1) and population (n) standard deviation.
- Missing Simpson's paradox, where a trend in every group reverses when the groups are combined.
- Ignoring the target's class balance. On a 98/2 split, 98% accuracy can mean the model learnt nothing.
Worked examples
1. Understanding. A box plot of delivery times has its median line close to the bottom of the box and a long upper whisker. What shape is the distribution? Answer: right-skewed. Most values are bunched low, with a long tail of slow deliveries, so the mean will sit above the median.
2. Application. What are the mean and median of 2, 4, 6, 8, 30? Answer: the mean is 50 / 5 = 10 and the median is 6. The single value 30 pulls the mean well above the typical value.
3. Analysis. Across cities, the number of mobile shops correlates at r = 0.9 with the number of road accidents. Should the city close mobile shops? Answer: no. Population size drives both counts, so it is a confounder. Comparing rates per 100,000 people would remove most of the association.
Practise
The quiz below has 100 questions on this topic, filterable by tier and difficulty.
Practise: 100 questions
FAQs
What are the main steps of EDA?
Check the shape and data types, count missing values and duplicates, summarise each variable (centre, spread, distribution), plot each variable alone, then plot pairs and the target to study relationships. Finish by noting outliers, skewed features, imbalance and redundant columns, because each of these shapes your pre-processing and model choice.
When should I use the median instead of the mean?
Use the median when the data is skewed or has outliers, as with salaries, prices or delivery times, because it reports a typical value. The mean is fine for roughly symmetric data and is needed when you care about totals, since mean x count = sum.
What is the difference between Pearson and Spearman correlation?
Pearson measures how well the points fit a straight line and uses the raw values. Spearman ranks each variable first and then applies Pearson to the ranks, so it captures any consistently increasing or decreasing pattern and is less affected by outliers. Use Spearman for ordinal data or curved but monotonic trends.
Which plots are most useful in EDA?
Histograms and box plots for one numeric variable, bar charts for categories, scatter plots for two numeric variables, and a correlation heatmap for many numeric features at once. Box plots split by class are a quick way to see which features separate the target.
Next step
Continue with Supervised Learning, the next topic in HEC's order. You can also return to the AI & ML MCQs hub or test yourself in an NSCT mock test.